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

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new 2985d42978 libavutil/pixdesc: fix prefix matching in *_from_name() 
functions
2985d42978 is described below

commit 2985d4297883bf7599c0f96f103e7f5a924ce467
Author:     marcos ashton <[email protected]>
AuthorDate: Fri May 8 15:22:18 2026 +0100
Commit:     michaelni <[email protected]>
CommitDate: Tue Jun 23 23:42:38 2026 +0000

    libavutil/pixdesc: fix prefix matching in *_from_name() functions
    
    The seven *_from_name() functions in pixdesc.c (color_range,
    color_primaries, color_transfer, color_space, chroma_location,
    alpha_mode) used av_strstart() for prefix matching, which returns
    incorrect results when one name is a prefix of another.
    
    av_color_space_from_name("ycgco-re") matched "ycgco" at index
    AVCOL_SPC_YCGCO and returned 8 instead of AVCOL_SPC_YCGCO_RE.
    av_color_space_from_name("ycgco-ro") had the same issue. The
    *_ext name lookups inside av_color_primaries_from_name and
    av_color_transfer_from_name had the same flaw.
    
    Switch all eight call sites from av_strstart() to strcmp() for
    exact matching. No in-tree callers rely on prefix matching.
    
    Signed-off-by: marcos ashton <[email protected]>
---
 libavutil/pixdesc.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 90f9596def..ba25a25617 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -3780,7 +3780,7 @@ int av_color_range_from_name(const char *name)
     int i;
 
     for (i = 0; i < FF_ARRAY_ELEMS(color_range_names); i++) {
-        if (av_strstart(name, color_range_names[i], NULL))
+        if (!strcmp(name, color_range_names[i]))
             return i;
     }
 
@@ -3805,7 +3805,7 @@ int av_color_primaries_from_name(const char *name)
         if (!color_primaries_names[i])
             continue;
 
-        if (av_strstart(name, color_primaries_names[i], NULL))
+        if (!strcmp(name, color_primaries_names[i]))
             return i;
     }
 
@@ -3813,7 +3813,7 @@ int av_color_primaries_from_name(const char *name)
         if (!color_primaries_names_ext[i])
             continue;
 
-        if (av_strstart(name, color_primaries_names_ext[i], NULL))
+        if (!strcmp(name, color_primaries_names_ext[i]))
             return AVCOL_PRI_EXT_BASE + i;
     }
 
@@ -3838,7 +3838,7 @@ int av_color_transfer_from_name(const char *name)
         if (!color_transfer_names[i])
             continue;
 
-        if (av_strstart(name, color_transfer_names[i], NULL))
+        if (!strcmp(name, color_transfer_names[i]))
             return i;
     }
 
@@ -3846,7 +3846,7 @@ int av_color_transfer_from_name(const char *name)
         if (!color_transfer_names_ext[i])
             continue;
 
-        if (av_strstart(name, color_transfer_names_ext[i], NULL))
+        if (!strcmp(name, color_transfer_names_ext[i]))
             return AVCOL_TRC_EXT_BASE + i;
     }
 
@@ -3867,7 +3867,7 @@ int av_color_space_from_name(const char *name)
         if (!color_space_names[i])
             continue;
 
-        if (av_strstart(name, color_space_names[i], NULL))
+        if (!strcmp(name, color_space_names[i]))
             return i;
     }
 
@@ -3888,7 +3888,7 @@ int av_chroma_location_from_name(const char *name)
         if (!chroma_location_names[i])
             continue;
 
-        if (av_strstart(name, chroma_location_names[i], NULL))
+        if (!strcmp(name, chroma_location_names[i]))
             return i;
     }
 
@@ -3930,7 +3930,7 @@ enum AVAlphaMode av_alpha_mode_from_name(const char *name)
         if (!alpha_mode_names[i])
             continue;
 
-        if (av_strstart(name, alpha_mode_names[i], NULL))
+        if (!strcmp(name, alpha_mode_names[i]))
             return i;
     }
 

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

Reply via email to