Skip to content

Commit

Permalink
XPM: fix read heap buffer overflow on corrupted image. Fixes https://…
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Feb 28, 2019
1 parent 83ccdc0 commit cc5d840
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gdal/frmts/xpm/xpmdataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,8 @@ ParseXPM( const char *pszInput,

for( int iColor = 0; iColor < nColorCount; iColor++ )
{
if( papszXPMList[iColor+1] == nullptr )
if( papszXPMList[iColor+1] == nullptr ||
papszXPMList[iColor+1][0] == '\0' )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Missing color definition for %d in XPM header.",
Expand Down

0 comments on commit cc5d840

Please sign in to comment.