[gdal-dev] null pointer check needed in shptree.c

Martin Chapman mchapman at fortifieddatacom.com
Sun Oct 12 16:25:21 EDT 2008


Frank,

In the file shptree.c on line 261  (psShape = SHPReadObject( hSHP, iShape
);) in function SHPCreateTree() when the call to SHPReadObject() returns
NULL the code crashes because the following line (262) tries to use the
psShape pointer without checking if it is NULL.  SHPReadObject() correctly
captures the error but stills fails in SHPCreateTree().  I know the shape
file is probably invalid but other shape drivers handle it correctly so it
would be nice if you could stick an if (psShape == NULL) check in there so
it doesn't just crash hard. If you need a file that does this please let me
know and I will send it to you.

Best regards,
Martin




More information about the gdal-dev mailing list