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

Git pushed a commit to branch master
in repository ffmpeg.

commit 61c22c71c2553e6de783fae4c61c2bf3b5856e85
Author:     Andreas Rheinhardt <[email protected]>
AuthorDate: Sat Feb 21 14:01:00 2026 +0100
Commit:     Andreas Rheinhardt <[email protected]>
CommitDate: Tue Mar 10 13:52:18 2026 +0100

    avformat/yuv4mpegdec: Fix shadowing
    
    Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 libavformat/yuv4mpegdec.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavformat/yuv4mpegdec.c b/libavformat/yuv4mpegdec.c
index 5c21858908..7e31780a20 100644
--- a/libavformat/yuv4mpegdec.c
+++ b/libavformat/yuv4mpegdec.c
@@ -36,7 +36,6 @@ static int yuv4_read_header(AVFormatContext *s)
     char header[MAX_YUV4_HEADER + 10];  // Include headroom for
                                         // the longest option
     char *tokstart, *tokend, *header_end;
-    int i;
     AVIOContext *pb = s->pb;
     int width = -1, height  = -1, raten   = 0,
         rated =  0, aspectn =  0, aspectd = 0;
@@ -47,25 +46,25 @@ static int yuv4_read_header(AVFormatContext *s)
     AVStream *st;
     int64_t data_offset;
 
-    for (i = 0; i < MAX_YUV4_HEADER; i++) {
+    for (int i = 0;;) {
         header[i] = avio_r8(pb);
         if (header[i] == '\n') {
             header[i + 1] = 0x20;  // Add a space after last option.
                                    // Makes parsing "444" vs "444alpha" easier.
             header[i + 2] = 0;
+            header_end = &header[i + 1]; // Include space
             break;
         }
-    }
-    if (i == MAX_YUV4_HEADER) {
-        av_log(s, AV_LOG_ERROR, "Header too large.\n");
-        return AVERROR(EINVAL);
+        if (++i == MAX_YUV4_HEADER) {
+            av_log(s, AV_LOG_ERROR, "Header too large.\n");
+            return AVERROR(EINVAL);
+        }
     }
     if (strncmp(header, Y4M_MAGIC, strlen(Y4M_MAGIC))) {
         av_log(s, AV_LOG_ERROR, "Invalid magic number for yuv4mpeg.\n");
         return AVERROR(EINVAL);
     }
 
-    header_end = &header[i + 1]; // Include space
     for (tokstart = &header[strlen(Y4M_MAGIC) + 1];
          tokstart < header_end; tokstart++) {
         if (*tokstart == 0x20)
@@ -117,6 +116,7 @@ static int yuv4_read_header(AVFormatContext *s)
                 { "mono9",    AV_PIX_FMT_GRAY9,     AVCHROMA_LOC_UNSPECIFIED },
                 { "mono",     AV_PIX_FMT_GRAY8,     AVCHROMA_LOC_UNSPECIFIED },
             };
+            size_t i;
             for (i = 0; i < FF_ARRAY_ELEMS(pix_fmt_array); i++) {
                 if (av_strstart(tokstart, pix_fmt_array[i].name, NULL)) {
                     pix_fmt = pix_fmt_array[i].pix_fmt;

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to