2008-06-04 Joel Sherrill <joel.sherrill@OARcorp.com>

* score/src/objectgetinfo.c, score/src/objectidtoname.c,
	score/src/threadget.c: Make sure the pointer to the API object table
	is valid before derefencing it.
This commit is contained in:
Joel Sherrill
2008-06-04 23:05:37 +00:00
parent e51cf6db88
commit d8d373a1f2
4 changed files with 21 additions and 2 deletions

View File

@@ -1,3 +1,9 @@
2008-06-04 Joel Sherrill <joel.sherrill@OARcorp.com>
* score/src/objectgetinfo.c, score/src/objectidtoname.c,
score/src/threadget.c: Make sure the pointer to the API object table
is valid before derefencing it.
2008-06-02 Joel Sherrill <joel.sherrill@oarcorp.com>
* score/include/rtems/score/interr.h, score/src/interr.c: Convention

View File

@@ -31,6 +31,9 @@ Objects_Information *_Objects_Get_information(
if ( !the_class || the_class > _Objects_API_maximum_class(the_api) )
return NULL;
if ( !_Objects_Information_table[ the_api ] )
return NULL;
info = _Objects_Information_table[ the_api ][ the_class ];
if ( !info )
return NULL;

View File

@@ -54,7 +54,10 @@ Objects_Name_or_id_lookup_errors _Objects_Id_to_name (
tmpId = (id == OBJECTS_ID_OF_SELF) ? _Thread_Executing->Object.id : id;
the_api = _Objects_Get_API( tmpId );
if ( the_api && the_api > OBJECTS_APIS_LAST )
if ( !_Objects_Is_api_valid( the_api ) )
return OBJECTS_INVALID_ID;
if ( !_Objects_Information_table[ the_api ] )
return OBJECTS_INVALID_ID;
the_class = _Objects_Get_class( tmpId );

View File

@@ -53,6 +53,7 @@ Thread_Control *_Thread_Get (
{
uint32_t the_api;
uint32_t the_class;
Objects_Information **api_information;
Objects_Information *information;
Thread_Control *tp = (Thread_Control *) 0;
@@ -75,7 +76,13 @@ Thread_Control *_Thread_Get (
goto done;
}
information = _Objects_Information_table[ the_api ][ the_class ];
api_information = _Objects_Information_table[ the_api ];
if ( !api_information ) {
*location = OBJECTS_ERROR;
goto done;
}
information = api_information[ the_class ];
if ( !information ) {
*location = OBJECTS_ERROR;
goto done;