Skip to content

Commit

Permalink
fix #1042 (EXIF offset larger than data)
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Dec 14, 2023
1 parent 4332b48 commit 26ec395
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/encoder_jpeg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ bool JpegEncoder::Encode(const struct heif_image_handle* handle,
uint32_t skip = (exifdata[0]<<24) | (exifdata[1]<<16) | (exifdata[2]<<8) | exifdata[3];
skip += 4;

if (skip > exifsize) {
fprintf(stderr, "Invalid EXIF data (offset too large)\n");
return false;
}

uint8_t* ptr = exifdata + skip;
size_t size = exifsize - skip;

Expand Down

0 comments on commit 26ec395

Please sign in to comment.