heifload: prevent reading beyond end of source buffer

This commit is contained in:
Lovell Fuller 2020-09-25 18:51:48 +01:00 committed by John Cupitt
parent cdae2c1995
commit 7829518847
1 changed files with 5 additions and 1 deletions

View File

@ -961,7 +961,11 @@ vips_foreign_load_heif_wait_for_file_size( gint64 target_size, void *userdata )
enum heif_reader_grow_status status;
if( heif->length == -1 )
if( heif->source->data != NULL && target_size > heif->source->length )
/* Target size is beyond known buffer length
*/
status = heif_reader_grow_status_size_beyond_eof;
else if( heif->length == -1 )
/* We've not seen EOF yet, so seeking to any point is fine (as
* far as we know).
*/