Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions ext/exif/exif.c
Original file line number Diff line number Diff line change
Expand Up @@ -3750,7 +3750,7 @@ static void exif_process_TIFF_in_JPEG(image_info_type *ImageInfo, char *CharBuf,
static void exif_process_APP1(image_info_type *ImageInfo, char *CharBuf, size_t length, size_t displacement)
{
/* Check the APP1 for Exif Identifier Code */
static const uchar ExifHeader[] = {0x45, 0x78, 0x69, 0x66, 0x00, 0x00};
static const uchar ExifHeader[] = {'E', 'x', 'i', 'f', 0, 0};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this just be "Exif\x00\x00" directly in the memcmp()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes for this one, but the HEIF check in exif_scan_HEIF_header() uses sizeof(ExifHeader) for both the compare length and the skip offset, so it needs the named array there. Kept this site matching it rather than splitting the style across the two.

if (length <= 8 || memcmp(CharBuf+2, ExifHeader, 6)) {
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Incorrect APP1 Exif Identifier Code");
return;
Expand Down Expand Up @@ -4447,8 +4447,7 @@ static bool exif_scan_HEIF_header(image_info_type *ImageInfo, unsigned char *buf

static bool exif_scan_WEBP_header(image_info_type *ImageInfo, size_t riff_size)
{
/* "Exif\0\0" identifier code */
static const uchar ExifHeader[] = {0x45, 0x78, 0x69, 0x66, 0x00, 0x00};
static const uchar ExifHeader[] = {'E', 'x', 'i', 'f', 0, 0};
unsigned char chunk_header[8];
size_t offset = 12;
size_t riff_end = riff_size <= ImageInfo->FileSize - 8 ? riff_size + 8 : ImageInfo->FileSize;
Expand Down
Loading