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 <leo.izen@gmail.com>
This commit is contained in:
Leo Izen 2026-04-04 11:33:12 -04:00
parent 2cddfe7d0c
commit 4f5dfce5a8
No known key found for this signature in database
GPG key ID: 764E48EA48221833

View file

@ -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;