This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch release/9.0
in repository ffmpeg.

commit 2efc141e661f04e036a6ffc208b4fb421f1d040b
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Mon Sep 14 03:37:23 2026 +0200
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Thu Sep 17 02:26:42 2026 +0200

    avcodec/cfhd: check the channel number after every tag
    
    Fixes: NULL pointer dereference
    Fixes: 5cNIJSj1u1Lc/input.bin
    Fixes: 5cNIJSj1u1Lc
    Found-by: Zheng Yu <[email protected]>
    (cherry picked from commit 4800bf20d82243fb8e3131061d3a3e70536c42fa)
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavcodec/cfhd.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index fb22eaa795..833ef67948 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -434,11 +434,6 @@ static int cfhd_decode(AVCodecContext *avctx, AVFrame *pic,
         } else if (tag == ChannelNumber) {
             s->channel_num = data;
             av_log(avctx, AV_LOG_DEBUG, "Channel number %"PRIu16"\n", data);
-            if (s->channel_num >= s->planes) {
-                av_log(avctx, AV_LOG_ERROR, "Invalid channel number\n");
-                ret = AVERROR(EINVAL);
-                goto end;
-            }
             init_plane_defaults(s);
         } else if (tag == SubbandNumber) {
             if (s->subband_num != 0 && data == 1 && (s->transform_type == 0 || 
s->transform_type == 2))  // hack
@@ -632,6 +627,12 @@ static int cfhd_decode(AVCodecContext *avctx, AVFrame *pic,
         } else
             av_log(avctx, AV_LOG_DEBUG,  "Unknown tag %i data %x\n", tag, 
data);
 
+        if (s->channel_num >= s->planes) {
+            av_log(avctx, AV_LOG_ERROR, "Invalid channel number\n");
+            ret = AVERROR(EINVAL);
+            goto end;
+        }
+
         if (tag == BitstreamMarker && data == CoefficientSegment &&
             s->coded_format != AV_PIX_FMT_NONE) {
             int lowpass_height = s->plane[s->channel_num].band[0][0].height;

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to