[FFmpeg-devel] [PATCH 5/5] avcodec/decode: use ff_icc_profile_sanitize

Niklas Haas ffmpeg at haasn.xyz
Wed Sep 27 13:03:56 EEST 2023


From: Niklas Haas <git at haasn.dev>

Fixes: https://trac.ffmpeg.org/ticket/9673
---
 libavcodec/decode.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 466c393c1e2..6f4ef7da0c2 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -536,7 +536,9 @@ static int detect_colorspace(AVCodecContext *avctx, AVFrame *frame)
     if (!profile)
         return AVERROR_INVALIDDATA;
 
-    ret = ff_icc_profile_read_primaries(&avci->icc, profile, &coeffs);
+    ret = ff_icc_profile_sanitize(&avci->icc, profile);
+    if (!ret)
+        ret = ff_icc_profile_read_primaries(&avci->icc, profile, &coeffs);
     if (!ret)
         ret = ff_icc_profile_detect_transfer(&avci->icc, profile, &trc);
     cmsCloseProfile(profile);
-- 
2.42.0



More information about the ffmpeg-devel mailing list