src/sd2.c : Validate data before using.

This commit is contained in:
Erik de Castro Lopo 2009-02-21 17:55:51 +11:00
parent 5a93e505ce
commit e840299f8b
2 changed files with 11 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2009-02-21 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/sd2.c
Validate data before using.
2009-02-20 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* Octave/octave_test.sh

View File

@ -477,6 +477,12 @@ sd2_parse_rsrc_fork (SF_PRIVATE *psf)
goto parse_rsrc_fork_cleanup ;
} ;
if (rsrc.map_offset + 26 >= rsrc.rsrc_len)
{ psf_log_printf (psf, "Bad map offset (%d + 26 > %d).\n", rsrc.map_offset, rsrc.rsrc_len) ;
error = SFE_SD2_BAD_RSRC ;
goto parse_rsrc_fork_cleanup ;
} ;
rsrc.string_offset = rsrc.map_offset + read_short (rsrc.rsrc_data, rsrc.map_offset + 26) ;
if (rsrc.string_offset > rsrc.rsrc_len)
{ psf_log_printf (psf, "Bad string offset (%d).\n", rsrc.string_offset) ;