objectgetinfo.c: Add test case for API field too high

This was spotted by Coverity as CID 1592935.

Closes #5076.
This commit is contained in:
Joel Sherrill
2024-07-27 10:29:05 -05:00
parent 0bd9737e58
commit 807070a696
3 changed files with 13 additions and 2 deletions
+3
View File
@@ -66,6 +66,9 @@ Objects_Information *_Objects_Get_information(
if ( !_Objects_Information_table[ the_api ] )
return NULL;
if ( the_class > OBJECTS_APIS_LAST )
return NULL;
info = _Objects_Information_table[ the_api ][ the_class ];
if ( !info )
return NULL;
+9 -2
View File
@@ -378,8 +378,15 @@ rtems_task Init(
);
puts( "rtems_object_get_class_information - INVALID_NUMBER (bad API)" );
sc =
rtems_object_get_class_information(0, OBJECTS_INTERNAL_THREADS, &info);
sc = rtems_object_get_class_information(0, OBJECTS_INTERNAL_THREADS, &info);
fatal_directive_status(
sc,
RTEMS_INVALID_NUMBER,
"rtems_object_get_class_information (API)"
);
puts( "rtems_object_get_class_information - INVALID_NUMBER (API too high)" );
sc = rtems_object_get_class_information(0, 4, &info);
fatal_directive_status(
sc,
RTEMS_INVALID_NUMBER,
+1
View File
@@ -5,6 +5,7 @@ rtems_object_get_classic_name - INVALID_ADDRESS
rtems_object_get_classic_name - INVALID_ID (bad index)
rtems_object_get_classic_name - INVALID_ID (unallocated index)
rtems_object_get_classic_name - INVALID_ID (bad API)
rtems_object_get_classic_name - INVALID_ID (API too high)
UI1 - name returned by rtems_object_get_classic_name for Init task id
UI1 - name returned by rtems_object_get_classic_name for RTEMS_SELF
TEMP - rtems_build_name for TEMP