Bug #2083

Chip.cpp could fail by using a NULL pointer

Added by Stuart Sides about 4 years ago. Updated about 3 years ago.

Software Version:
Test Reviewer:


Reported by external programmer.

The Chip class has the potential to us a NULL pointer at line 473. The line should be checked to make sure the projection is not NULL.

473 proj->SetUniversalGround(lat, lon);


#1 Updated by Tammy Becker about 4 years ago

  • Status changed from New to Acknowledged

Introduced recently. Applications that use the autoreg functionality (pointreg, coreg) could be impacted by this. The condition that would surface this issue has not been defined yet.

#3 Updated by Stuart Sides almost 4 years ago

  • Target version changed from 3.4.7 (2014-08-27 Aug) to 159

#9 Updated by Stuart Sides over 3 years ago

  • Target version deleted (159)

#11 Updated by Stuart Sides over 3 years ago

  • Assignee set to Ian Humphrey

#12 Updated by Stuart Sides over 3 years ago

  • Status changed from Acknowledged to Assigned

#14 Updated by Ian Humphrey about 3 years ago

  • Status changed from Assigned to In Progress
  • Target version set to 3.4.11 (FY16 R1 2015-10-28 Oct)

#15 Updated by Ian Humphrey about 3 years ago

  • Impact updated (diff)

#16 Updated by Ian Humphrey about 3 years ago

  • Status changed from In Progress to Rejected
  • Impact updated (diff)

Rejected because use of the Chip class's API cannot allow the proj pointer to be NULL at line 473 (see explanation below).

Note that this line of code occurs in one of Chip's Load functions (at line 320). At the beginning of this function, we initialize our Camera and Projection pointers, cam and proj, to NULL. We then check if the cube we are loading into the chip has a valid camera. If not, then we check if there is a valid map projection. If this fails, then an exception is thrown.

This yields three possibilities for the states of these pointers:
* The cam pointer is set and the proj pointer is NULL when the camera check is successful
* The cam pointer is NULL and the proj pointer is set when the camera check fails and the projection check is successful
* An exception is thrown when both the camera and projection checks fail

Now, later in this same function when we are using a lat/long to find a line/sample in the chip (starting at line 459), we check if the cam pointer is set. If it is set, we use the camera to find these values. Otherwise, we know that the proj pointer must be set (otherwise an exception would have been thrown as explained above) and subsequently use it to find the line/sample values.

#17 Updated by Stuart Sides about 3 years ago

I agree. Rejecting is the correct action.

Also available in: Atom PDF