diff --git a/README.md b/README.md index 83dcf71e2..af38adb95 100644 --- a/README.md +++ b/README.md @@ -16,12 +16,15 @@ This distribution contains: ## Version History +### Development Build: 5.0.17 + +- `OS_QueueCreate()` will return an error code if the depth parameter is larger than the configured `OS_MAX_QUEUE_DEPTH`. +- See + ### Development Build: 5.0.16 - Resized buffers and added explicit termination to string copies. No warnings on GCC9 with strict settings and optimization enabled. - - New API to reverse lookup an OS-provided thread/task identifier back to an OSAL ID. Any use of existing OStask_id field within the task property structure is now deprecated. - - See ### Development Build: 5.0.15 diff --git a/src/os/inc/osapi-os-core.h b/src/os/inc/osapi-os-core.h index a9c1f336d..760fe35ce 100644 --- a/src/os/inc/osapi-os-core.h +++ b/src/os/inc/osapi-os-core.h @@ -532,6 +532,7 @@ int32 OS_TaskFindIdBySystemData(uint32 *task_id, const void *sysdata, size_t sys * @retval #OS_ERR_NAME_TOO_LONG name length including null terminator greater than #OS_MAX_API_NAME * @retval #OS_ERR_NO_FREE_IDS if there are already the max queues created * @retval #OS_ERR_NAME_TAKEN if the name is already being used on another queue + * @retval #OS_QUEUE_INVALID_SIZE if the queue depth exceeds the limit * @retval #OS_ERROR if the OS create call fails */ int32 OS_QueueCreate (uint32 *queue_id, const char *queue_name, diff --git a/src/os/inc/osapi-version.h b/src/os/inc/osapi-version.h index 25ed8ed91..3090db9d4 100644 --- a/src/os/inc/osapi-version.h +++ b/src/os/inc/osapi-version.h @@ -20,7 +20,7 @@ #define OS_MAJOR_VERSION 5 /**< @brief Major version number */ #define OS_MINOR_VERSION 0 /**< @brief Minor version number */ -#define OS_REVISION 16 /**< @brief Revision number */ +#define OS_REVISION 17 /**< @brief Revision number */ #define OS_MISSION_REV 0 /**< @brief Mission revision */ /** diff --git a/src/os/shared/src/osapi-queue.c b/src/os/shared/src/osapi-queue.c index 7ebdc93ae..1df14ea95 100644 --- a/src/os/shared/src/osapi-queue.c +++ b/src/os/shared/src/osapi-queue.c @@ -102,6 +102,11 @@ int32 OS_QueueCreate (uint32 *queue_id, const char *queue_name, uint32 queue_dep return OS_ERR_NAME_TOO_LONG; } + if ( queue_depth > OS_QUEUE_MAX_DEPTH ) + { + return OS_QUEUE_INVALID_SIZE; + } + /* Note - the common ObjectIdAllocate routine will lock the object type and leave it locked. */ return_code = OS_ObjectIdAllocateNew(LOCAL_OBJID_TYPE, queue_name, &local_id, &record); if(return_code == OS_SUCCESS) diff --git a/src/unit-test-coverage/shared/src/coveragetest-queue.c b/src/unit-test-coverage/shared/src/coveragetest-queue.c index 6942c4117..bd007b5c5 100644 --- a/src/unit-test-coverage/shared/src/coveragetest-queue.c +++ b/src/unit-test-coverage/shared/src/coveragetest-queue.c @@ -63,6 +63,10 @@ void Test_OS_QueueCreate(void) actual = OS_QueueCreate(&objid, "UT", 0, 0,0); UtAssert_True(actual == expected, "OS_QueueCreate() (%ld) == OS_ERR_NAME_TOO_LONG", (long)actual); UT_ClearForceFail(UT_KEY(OCS_strlen)); + + expected = OS_QUEUE_INVALID_SIZE; + actual = OS_QueueCreate(&objid, "UT", 1 + OS_QUEUE_MAX_DEPTH, 0,0); + UtAssert_True(actual == expected, "OS_QueueCreate() (%ld) == OS_QUEUE_INVALID_SIZE", (long)actual); } void Test_OS_QueueDelete(void)