[FFmpeg-devel] [PATCH] Two exif Fixes (PR #20326)

2025-08-24 Thread Leo Izen via ffmpeg-devel
PR #20326 opened by Leo Izen (Traneptora)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20326
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20326.patch

Fixes for two EXIF bugs, notably #20305 and #20291.


>From c9e86ffd2ae9b3f296b761f3d7c2f10d69a46840 Mon Sep 17 00:00:00 2001
From: Leo Izen 
Date: Sun, 24 Aug 2025 08:54:16 -0400
Subject: [PATCH 1/2] avcodec/exif: avoid writing native-endian EXIF buffers

Currently there's platform-dependent behavior where if no endianness
is requested, it writes the buffers in native-endian. This breaks FATE
tests on big-endian architecture. This commit changes the default to
little-endian buffers upon writing.

Fixes: #20291.

Signed-off-by: Leo Izen 
---
 libavcodec/exif.c | 10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/libavcodec/exif.c b/libavcodec/exif.c
index 16635e1678..908a4a3d14 100644
--- a/libavcodec/exif.c
+++ b/libavcodec/exif.c
@@ -695,11 +695,7 @@ int av_exif_write(void *logctx, const AVExifMetadata *ifd, 
AVBufferRef **buffer,
 PutByteContext pb;
 int ret, off = 0;
 
-#if AV_HAVE_BIGENDIAN
-int le = 0;
-#else
 int le = 1;
-#endif
 
 if (*buffer)
 return AVERROR(EINVAL);
@@ -736,12 +732,8 @@ int av_exif_write(void *logctx, const AVExifMetadata *ifd, 
AVBufferRef **buffer,
 
 if (header_mode != AV_EXIF_ASSUME_BE && header_mode != AV_EXIF_ASSUME_LE) {
 /* these constants are be32 in both cases */
-/* this is a #if instead of a ternary to suppress a deadcode warning */
-#if AV_HAVE_BIGENDIAN
-bytestream2_put_be32(&pb, EXIF_MM_LONG);
-#else
+/* le == 1 always in this case */
 bytestream2_put_be32(&pb, EXIF_II_LONG);
-#endif
 tput32(&pb, le, 8);
 }
 
-- 
2.49.1


>From e754031691d320187ce3edebc2fce71a884735ee Mon Sep 17 00:00:00 2001
From: Leo Izen 
Date: Sun, 24 Aug 2025 09:12:49 -0400
Subject: [PATCH 2/2] avcodec/exif: avoid allocation failure on empty EXIF
 metadata

An EXIF IFD with 0 entries is legal, but does not contain metadata. We
should not attempt to allocate a struct with size zero in this case, as
this causes an allocation failure. Instead, we just leave the struct
empty.

Fixes: #20305.

Signed-off-by: Leo Izen 
---
 libavcodec/exif.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavcodec/exif.c b/libavcodec/exif.c
index 908a4a3d14..f7effa6dbd 100644
--- a/libavcodec/exif.c
+++ b/libavcodec/exif.c
@@ -552,6 +552,10 @@ static int exif_parse_ifd_list(void *logctx, 
GetByteContext *gb, int le,
 ifd->count = entries;
 av_log(logctx, AV_LOG_DEBUG, "entry count for IFD: %u\n", ifd->count);
 
+/* empty IFD is technically legal but equivalent to no metadata present */
+if (!ifd->count)
+goto end;
+
 if (av_size_mult(ifd->count, sizeof(*ifd->entries), &required_size) < 0)
 return AVERROR(ENOMEM);
 temp = av_fast_realloc(ifd->entries, &ifd->size, required_size);
@@ -571,6 +575,7 @@ static int exif_parse_ifd_list(void *logctx, GetByteContext 
*gb, int le,
 return ret;
 }
 
+end:
 /*
  * at the end of an IFD is an pointer to the next IFD
  * or zero if there are no more IFDs, which is usually the case
@@ -1009,7 +1014,7 @@ static int exif_get_entry(void *logctx, AVExifMetadata 
*ifd, uint16_t id, int de
 {
 int offset = 1;
 
-if (!ifd || ifd->entries && !ifd->count || ifd->count && !ifd->entries || 
!value)
+if (!ifd || ifd->count && !ifd->entries || !value)
 return AVERROR(EINVAL);
 
 for (size_t i = 0; i < ifd->count; i++) {
@@ -1043,7 +1048,7 @@ int av_exif_set_entry(void *logctx, AVExifMetadata *ifd, 
uint16_t id, enum AVTif
 AVExifEntry *entry = NULL;
 AVExifEntry src = { 0 };
 
-if (!ifd || ifd->entries && !ifd->count || ifd->count && !ifd->entries
+if (!ifd || ifd->count && !ifd->entries
  || ifd_lead && !ifd_offset || !ifd_lead && ifd_offset
  || !value || ifd->count == 0xu)
 return AVERROR(EINVAL);
@@ -1089,7 +1094,7 @@ static int exif_remove_entry(void *logctx, AVExifMetadata 
*ifd, uint16_t id, int
 int32_t index = -1;
 int ret = 0;
 
-if (!ifd || ifd->entries && !ifd->count || ifd->count && !ifd->entries)
+if (!ifd || ifd->count && !ifd->entries)
 return AVERROR(EINVAL);
 
 for (size_t i = 0; i < ifd->count; i++) {
-- 
2.49.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] avcodec/libjxldec: submit frame after file is complete (PR #20337)

2025-08-25 Thread Leo Izen via ffmpeg-devel
PR #20337 opened by Leo Izen (Traneptora)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20337
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20337.patch

This commit causes the libjxl decoder wrapper to hold onto the decoded
frame until the trailing metadata after the frame is possibly complete
before it submits the frame. This allows EXIF and other metadata boxes
that occur after the frame is fully rendered to be attached to it as
side data.

Signed-off-by: Leo Izen 


>From cbb8fd2c12d56ad4a937ed1c637b5829b29b0aa3 Mon Sep 17 00:00:00 2001
From: Leo Izen 
Date: Mon, 25 Aug 2025 10:56:25 -0400
Subject: [PATCH] avcodec/libjxldec: submit frame after file is complete

This commit causes the libjxl decoder wrapper to hold onto the decoded
frame until the trailing metadata after the frame is possibly complete
before it submits the frame. This allows EXIF and other metadata boxes
that occur after the frame is fully rendered to be attached to it as
side data.

Signed-off-by: Leo Izen 
---
 libavcodec/libjxldec.c | 108 ++---
 1 file changed, 69 insertions(+), 39 deletions(-)

diff --git a/libavcodec/libjxldec.c b/libavcodec/libjxldec.c
index 31f4592d1c..13308ed01d 100644
--- a/libavcodec/libjxldec.c
+++ b/libavcodec/libjxldec.c
@@ -61,6 +61,8 @@ typedef struct LibJxlDecodeContext {
 int prev_is_last;
 AVRational anim_timebase;
 AVFrame *frame;
+int frame_complete;
+JxlDecoderStatus jret;
 AVBufferRef *exif;
 size_t exif_pos;
 } LibJxlDecodeContext;
@@ -371,10 +373,56 @@ static int libjxl_color_encoding_event(AVCodecContext 
*avctx, AVFrame *frame)
 return 0;
 }
 
+static int libjxl_attach_sidedata(AVCodecContext *avctx)
+{
+LibJxlDecodeContext *ctx = avctx->priv_data;
+int ret = 0;
+
+if (ctx->iccp) {
+ret = ff_frame_new_side_data_from_buf(avctx, ctx->frame, 
AV_FRAME_DATA_ICC_PROFILE, &ctx->iccp);
+if (ret < 0)
+return ret;
+}
+
+if (ctx->exif) {
+AVExifMetadata ifd = { 0 };
+/* size may be larger than exif_pos due to the realloc loop */
+ret = av_exif_parse_buffer(avctx, ctx->exif->data, ctx->exif_pos, 
&ifd, AV_EXIF_T_OFF);
+av_buffer_unref(&ctx->exif);
+if (ret < 0) {
+av_log(avctx, AV_LOG_ERROR, "Unable to parse EXIF buffer: %s\n", 
av_err2str(ret));
+return ret;
+}
+/*
+ * JPEG XL Codestream orientation overrides EXIF orientation in all 
cases.
+ * As a result, we remove the EXIF Orientation tag rather than just 
zeroing it
+ * in order to prevent any ambiguity. libjxl autorotates the image for 
us so we
+ * do not need to worry about that.
+ */
+ret = av_exif_remove_entry(avctx, &ifd, 
av_exif_get_tag_id("Orientation"), 0);
+if (ret < 0)
+av_log(avctx, AV_LOG_WARNING, "Unable to remove orientation from 
EXIF buffer: %s\n", av_err2str(ret));
+ret = ff_decode_exif_attach_ifd(avctx, ctx->frame, &ifd);
+if (ret < 0)
+av_log(avctx, AV_LOG_ERROR, "Unable to attach EXIF ifd: %s\n", 
av_err2str(ret));
+av_exif_free(&ifd);
+}
+
+return ret;
+}
+
+static int libjxl_finalize_frame(AVCodecContext *avctx, AVFrame *dst, AVFrame 
*src)
+{
+LibJxlDecodeContext *ctx = avctx->priv_data;
+int ret = libjxl_attach_sidedata(avctx);
+av_frame_move_ref(dst, src);
+ctx->frame_complete = 0;
+return ret;
+}
+
 static int libjxl_receive_frame(AVCodecContext *avctx, AVFrame *frame)
 {
 LibJxlDecodeContext *ctx = avctx->priv_data;
-JxlDecoderStatus jret = JXL_DEC_SUCCESS;
 int ret;
 AVPacket *pkt = ctx->avpkt;
 
@@ -391,23 +439,26 @@ static int libjxl_receive_frame(AVCodecContext *avctx, 
AVFrame *frame)
 ctx->frame_duration = 0;
 if (!pkt->size) {
 /* jret set by the last iteration of the loop */
-if (jret == JXL_DEC_NEED_MORE_INPUT) {
+if (ctx->jret == JXL_DEC_NEED_MORE_INPUT && 
!ctx->frame_complete) {
 av_log(avctx, AV_LOG_ERROR, "Unexpected end of JXL 
codestream\n");
 return AVERROR_INVALIDDATA;
-} else {
-return AVERROR_EOF;
+} else if (ctx->frame_complete) {
+libjxl_finalize_frame(avctx, frame, ctx->frame);
+ctx->jret = JXL_DEC_SUCCESS;
+return 0;
 }
+return AVERROR_EOF;
 }
 }
 
-jret = JxlDecoderSetInput(ctx->decoder, pkt->data, pkt->size);
-if (jret == JXL_DEC_ERROR) {
+ctx->jret = JxlDecoderSetInput(ctx->decoder, pkt->data, pkt->size);
+if (ctx->jret == JXL_DEC_ERROR) {
 /* this should never happen here unless there's a bug in libjxl */
 av_log(avctx, AV_LOG_ERROR, "Unknown libjxl decode error\n");
 return AVERROR_EXTERNAL;
 }
 
-  

[FFmpeg-devel] [PATCH] avcodec/exif: fix some coverity errors (PR #20296)

2025-08-20 Thread Leo Izen via ffmpeg-devel
PR #20296 opened by Leo Izen (Traneptora)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20296
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20296.patch

This commit fixes some memory and security issues due to improper
sanitizing and checks.

Fixes:
 - CID 1665100..1665107

Signed-off-by: Leo Izen 
Reportedy-by: James Almer 


>From 954fcecf4aa582eee5d93561fd85a8dcba218683 Mon Sep 17 00:00:00 2001
From: Leo Izen 
Date: Wed, 20 Aug 2025 21:40:28 -0400
Subject: [PATCH] avcodec/exif: fix some coverity errors

This commit fixes some memory and security issues due to improper
sanitizing and checks.

Fixes:
 - CID 1665100..1665107

Signed-off-by: Leo Izen 
Reportedy-by: James Almer 
---
 libavcodec/exif.c | 27 +++
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/libavcodec/exif.c b/libavcodec/exif.c
index 48959eb9b3..2513ee4ec0 100644
--- a/libavcodec/exif.c
+++ b/libavcodec/exif.c
@@ -322,12 +322,17 @@ static int exif_read_values(void *logctx, GetByteContext 
*gb, int le, AVExifEntr
 break;
 case AV_TIFF_UNDEFINED:
 case AV_TIFF_BYTE:
+/* these three fields are aliased to entry->value.ptr via a union 
*/
+/* and entry->value.ptr will always be nonzero here */
+av_assert0(entry->value.ubytes);
 bytestream2_get_buffer(gb, entry->value.ubytes, entry->count);
 break;
 case AV_TIFF_SBYTE:
+av_assert0(entry->value.sbytes);
 bytestream2_get_buffer(gb, entry->value.sbytes, entry->count);
 break;
 case AV_TIFF_STRING:
+av_assert0(entry->value.str);
 bytestream2_get_buffer(gb, entry->value.str, entry->count);
 break;
 }
@@ -471,6 +476,10 @@ static int exif_decode_tag(void *logctx, GetByteContext 
*gb, int le,
 av_log(logctx, AV_LOG_DEBUG, "TIFF Tag: id: 0x%04x, type: %d, count: %u, 
offset: %d, "
  "payload: %" PRIu32 "\n", entry->id, type, 
count, tell, payload);
 
+/* AV_TIFF_IFD is the largest, numerically */
+if (type > AV_TIFF_IFD)
+return AVERROR_INVALIDDATA;
+
 is_ifd = type == AV_TIFF_IFD || ff_tis_ifd(entry->id) || entry->id == 
MAKERNOTE_TAG;
 
 if (is_ifd) {
@@ -541,6 +550,11 @@ static int exif_parse_ifd_list(void *logctx, 
GetByteContext *gb, int le,
 av_log(logctx, AV_LOG_ERROR, "not enough bytes remaining in EXIF 
buffer. entries: %" PRIu32 "\n", entries);
 return AVERROR_INVALIDDATA;
 }
+if (entries > 4096) {
+/* that is a lot of entries, probably an error */
+av_log(logctx, AV_LOG_ERROR, "too many entries: %" PRIu32 "\n", 
entries);
+return AVERROR_INVALIDDATA;
+}
 
 ifd->count = entries;
 av_log(logctx, AV_LOG_DEBUG, "entry count for IFD: %u\n", ifd->count);
@@ -729,7 +743,12 @@ int av_exif_write(void *logctx, const AVExifMetadata *ifd, 
AVBufferRef **buffer,
 
 if (header_mode != AV_EXIF_ASSUME_BE && header_mode != AV_EXIF_ASSUME_LE) {
 /* these constants are be32 in both cases */
-bytestream2_put_be32(&pb, le ? EXIF_II_LONG : EXIF_MM_LONG);
+/* this is a #if instead of a ternary to suppress a deadcode warning */
+#if AV_HAVE_BIGENDIAN
+bytestream2_put_be32(&pb, EXIF_MM_LONG);
+#else
+bytestream2_put_be32(&pb, EXIF_II_LONG);
+#endif
 tput32(&pb, le, 8);
 }
 
@@ -897,10 +916,10 @@ static int exif_ifd_to_dict(void *logctx, const char 
*prefix, const AVExifMetada
 if (ret < 0)
 goto end;
 ret = av_dict_set(metadata, key, value, AV_DICT_DONT_STRDUP_KEY | 
AV_DICT_DONT_STRDUP_VAL);
-if (ret < 0)
-goto end;
 key = NULL;
 value = NULL;
+if (ret < 0)
+goto end;
 } else {
 av_freep(&key);
 }
@@ -970,7 +989,7 @@ static int exif_attach_ifd(void *logctx, AVFrame *frame, 
const AVExifMetadata *i
 
 ret = av_exif_ifd_to_dict(logctx, cloned ? cloned : ifd, &frame->metadata);
 if (ret < 0)
-return ret;
+goto end;
 
 if (cloned || !og) {
 ret = av_exif_write(logctx, cloned ? cloned : ifd, &written, 
AV_EXIF_TIFF_HEADER);
-- 
2.49.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH] avcodec/libjxldec: consume input on error (PR #20355)

2025-08-27 Thread Leo Izen via ffmpeg-devel
PR #20355 opened by Leo Izen (Traneptora)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20355
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20355.patch

libjxl consumes no input if it returns an error, so this loops over
and over while it spits out the same error many times. If we got an
error from libjxl and consumed no input, then we instead consume the
whole packet.

Signed-off-by: Leo Izen 


>From d808b0fc63506f224182872a78e6d2646e4e177d Mon Sep 17 00:00:00 2001
From: Leo Izen 
Date: Wed, 27 Aug 2025 11:53:23 -0400
Subject: [PATCH] avcodec/libjxldec: consume input on error

libjxl consumes no input if it returns an error, so this loops over
and over while it spits out the same error many times. If we got an
error from libjxl and consumed no input, then we instead consume the
whole packet.

Signed-off-by: Leo Izen 
---
 libavcodec/libjxldec.c | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libjxldec.c b/libavcodec/libjxldec.c
index 8ce69015bf..6e42b3bb2c 100644
--- a/libavcodec/libjxldec.c
+++ b/libavcodec/libjxldec.c
@@ -414,12 +414,22 @@ static int libjxl_receive_frame(AVCodecContext *avctx, 
AVFrame *frame)
  * the number of bytes that it did read
  */
 remaining = JxlDecoderReleaseInput(ctx->decoder);
-pkt->data += pkt->size - remaining;
+size_t consumed = pkt->size - remaining;
+pkt->data += consumed;
 pkt->size = remaining;
 
 switch(jret) {
 case JXL_DEC_ERROR:
 av_log(avctx, AV_LOG_ERROR, "Unknown libjxl decode error\n");
+if (!consumed) {
+/*
+ * we consume all remaining input on error, if nothing was 
consumed
+ * this prevents libjxl from consuming nothing forever
+ * and just dumping the last error over and over
+ */
+pkt->data += pkt->size;
+pkt->size = 0;
+}
 return AVERROR_INVALIDDATA;
 case JXL_DEC_NEED_MORE_INPUT:
 av_log(avctx, AV_LOG_DEBUG, "NEED_MORE_INPUT event emitted\n");
-- 
2.49.1

___
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-le...@ffmpeg.org


[FFmpeg-devel] [PATCH] libjxldec/libjxlenc: fix leaks (PR #20352)

2025-08-27 Thread Leo Izen via ffmpeg-devel
PR #20352 opened by Leo Izen (Traneptora)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20352
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20352.patch

Fix leaks. We forgot to free these.


>From a8d6b87a4442c690587db6f44cc7ed72a2de81fc Mon Sep 17 00:00:00 2001
From: Leo Izen 
Date: Wed, 27 Aug 2025 05:26:03 -0400
Subject: [PATCH 1/2] avcodec/libjxldec: fix leaked EXIF ifd

We're missing a call to av_exif_free here. We leak the internal heap-
allocated objects when &ifd goes out of scope.

Signed-off-by: Leo Izen 
---
 libavcodec/libjxldec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/libjxldec.c b/libavcodec/libjxldec.c
index 31f4592d1c..8ce69015bf 100644
--- a/libavcodec/libjxldec.c
+++ b/libavcodec/libjxldec.c
@@ -519,6 +519,7 @@ static int libjxl_receive_frame(AVCodecContext *avctx, 
AVFrame *frame)
 ret = ff_decode_exif_attach_ifd(avctx, ctx->frame, &ifd);
 if (ret < 0)
 av_log(avctx, AV_LOG_ERROR, "Unable to attach EXIF ifd\n");
+av_exif_free(&ifd);
 }
 if (ctx->basic_info.have_animation) {
 ctx->frame->pts = av_rescale_q(ctx->accumulated_pts, 
ctx->anim_timebase, avctx->pkt_timebase);
-- 
2.49.1


>From 041651841a1e11a6873a1d7b2f826b8678f8a2c8 Mon Sep 17 00:00:00 2001
From: Leo Izen 
Date: Wed, 27 Aug 2025 05:28:31 -0400
Subject: [PATCH 2/2] avcodec/libjxlenc: fix leaked EXIF ifd

We're missing a call to av_exif_free here. We leak the internal heap-
allocated objects when &ifd goes out of scope.

Signed-off-by: Leo Izen 
---
 libavcodec/libjxlenc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/libjxlenc.c b/libavcodec/libjxlenc.c
index 4f05f015e2..81c8233e40 100644
--- a/libavcodec/libjxlenc.c
+++ b/libavcodec/libjxlenc.c
@@ -394,6 +394,7 @@ static int libjxl_preprocess_stream(AVCodecContext *avctx, 
const AVFrame *frame,
 ret = av_exif_write(avctx, &ifd, &exif_buffer, 
AV_EXIF_TIFF_HEADER);
 if (ret < 0)
 av_log(avctx, AV_LOG_WARNING, "unable to process EXIF frame 
data\n");
+av_exif_free(&ifd);
 } else {
 sd = av_frame_get_side_data(frame, AV_FRAME_DATA_DISPLAYMATRIX);
 if (sd)
-- 
2.49.1

___
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-le...@ffmpeg.org


[FFmpeg-devel] [PATCH] .forge/CODEOWNERS: add myself to EXIF code (PR #20369)

2025-08-29 Thread Leo Izen via ffmpeg-devel
PR #20369 opened by Leo Izen (Traneptora)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20369
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20369.patch

Now that the major EXIF overhaul has been merged, I should be suggested
to review patches that modify it.

Signed-off-by: Leo Izen 


>From b81aa7d7ffabda6b24be6b71ff22d9a43a6a0bab Mon Sep 17 00:00:00 2001
From: Leo Izen 
Date: Fri, 29 Aug 2025 06:52:09 -0400
Subject: [PATCH] .forge/CODEOWNERS: add myself to EXIF code

Now that the major EXIF overhaul has been merged, I should be suggested
to review patches that modify it.

Signed-off-by: Leo Izen 
---
 .forgejo/CODEOWNERS | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.forgejo/CODEOWNERS b/.forgejo/CODEOWNERS
index 39abd7a832..d421aacb12 100644
--- a/.forgejo/CODEOWNERS
+++ b/.forgejo/CODEOWNERS
@@ -27,6 +27,7 @@ libavcodec/eacmv.* @pross
 libavcodec/eaidct.* @pross
 libavcodec/eamad.* @pross
 libavcodec/eat.* @pross
+libavcodec/.*exif.* @Traneptora
 libavcodec/.*ffv1.* @lynne @michaelni
 libavcodec/g728.* @pross
 libavcodec/gem.* @pross
@@ -104,6 +105,7 @@ libavformat/cine.* @pross
 libavformat/dsf.* @pross
 libavformat/eacdata.* @pross
 libavformat/electronicarts.* @pross
+libavformat/.*exif.* @Traneptora
 libavformat/filmstrip.* @pross
 libavformat/frm.* @pross
 libavformat/iamf.* @jamrial
-- 
2.49.1

___
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-le...@ffmpeg.org


[FFmpeg-devel] [PATCH] avcodec/decode: treat orientation 1 as valid displaymatrix (PR #20447)

2025-09-05 Thread Leo Izen via ffmpeg-devel
PR #20447 opened by Leo Izen (Traneptora)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20447
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20447.patch

Since 9dc79241d9680fc050376bb0cc37875a41d00cc9 we now always pop the
orientation off of the IFD and use a display matrix instead. This means
we should not produce a warning and refuse if the orientation field
indicates a default orientation (i.e. 1).

Signed-off-by: Leo Izen 
Reported-by: Ramiro Polla 


>From 3899fa1b53e0d3ba80ce8e26a19dfba66e449dc3 Mon Sep 17 00:00:00 2001
From: Leo Izen 
Date: Fri, 5 Sep 2025 11:44:41 -0400
Subject: [PATCH] avcodec/decode: treat orientation 1 as valid displaymatrix

Since 9dc79241d9680fc050376bb0cc37875a41d00cc9 we now always pop the
orientation off of the IFD and use a display matrix instead. This means
we should not produce a warning and refuse if the orientation field
indicates a default orientation (i.e. 1).

Signed-off-by: Leo Izen 
Reported-by: Ramiro Polla 
---
 libavcodec/decode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index f395948d60..ae86e270df 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -2337,7 +2337,7 @@ static int attach_displaymatrix(AVCodecContext *avctx, 
AVFrame *frame, int orien
 int32_t *matrix;
 int ret;
 /* invalid orientation */
-if (orientation < 2 || orientation > 8)
+if (orientation < 1 || orientation > 8)
 return AVERROR_INVALIDDATA;
 ret = ff_frame_new_side_data(avctx, frame, AV_FRAME_DATA_DISPLAYMATRIX, 
sizeof(int32_t) * 9, &sd);
 if (ret < 0) {
-- 
2.49.1

___
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-le...@ffmpeg.org