From 4f5dfce5a866caa95ab2dec03d236ee3dfe7a1ed Mon Sep 17 00:00:00 2001 From: Leo Izen Date: Sat, 4 Apr 2026 11:33:12 -0400 Subject: [PATCH] avcodec/exif.c: use less than or equal for max width and height The max width and height for PIXEL_X_TAG and PIXEL_Y_TAG is 0xFFFFu because these are unsigned shorts, but we used < instead of <= erroneously. Fix that. Signed-off-by: Leo Izen --- libavcodec/exif.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/exif.c b/libavcodec/exif.c index 8c2e41b764..9390532390 100644 --- a/libavcodec/exif.c +++ b/libavcodec/exif.c @@ -1465,7 +1465,7 @@ int ff_exif_sanitize_ifd(void *logctx, const AVFrame *frame, AVExifMetadata *ifd if (ret < 0) goto end; } - if (!pw && w && w < 0xFFFFu || !ph && h && h < 0xFFFFu) { + if (!pw && w && w <= 0xFFFFu || !ph && h && h <= 0xFFFFu) { AVExifMetadata *exif; AVExifEntry *exif_entry; int exif_found = av_exif_get_entry(logctx, ifd, EXIFIFD_TAG, 0, &exif_entry); @@ -1483,12 +1483,12 @@ int ff_exif_sanitize_ifd(void *logctx, const AVFrame *frame, AVExifMetadata *ifd } exif = &ifd->entries[ifd->count - 1].value.ifd; } - if (!pw && w && w < 0xFFFFu) { + if (!pw && w && w <= 0xFFFFu) { ret = av_exif_set_entry(logctx, exif, PIXEL_X_TAG, AV_TIFF_SHORT, 1, NULL, 0, &w); if (ret < 0) goto end; } - if (!ph && h && h < 0xFFFFu) { + if (!ph && h && h <= 0xFFFFu) { ret = av_exif_set_entry(logctx, exif, PIXEL_Y_TAG, AV_TIFF_SHORT, 1, NULL, 0, &h); if (ret < 0) goto end;