Merge pull request #1833 from lovell/libheif-check-source-buffer-length

heifload: prevent read beyond end of source buffer
This commit is contained in:
John Cupitt 2020-09-26 04:01:19 +01:00 committed by GitHub
commit 119bc7357d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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).
*/