Commit be68477fb2 for ffmpeg
commit be68477fb25bf92807a2e84828d4a8530f02f655
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Mon Oct 12 02:03:27 2026 +0200
avutil/opt: do not store a color that failed to parse
Fixes: use of uninitialized memory
Fixes: f78pyZFASSy9
Regression since: bd68a61304
Found during triage of the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24757
Use of uninitialized memory Replicated through UnModified FFmpeg with Valgrind
diff --git a/libavutil/opt.c b/libavutil/opt.c
index 041ad30280..0f69e04b3b 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -565,8 +565,10 @@ static int set_string_color(void *obj, const AVOption *o, const char *val, uint8
} else {
uint8_t tmp[4];
ret = av_parse_color(tmp, val, -1, obj);
- if (ret < 0)
+ if (ret < 0) {
av_log(logctx, AV_LOG_ERROR, "Unable to parse \"%s\" option value \"%s\" as color\n", o->name, val);
+ return ret;
+ }
if (dst)
memcpy(dst, tmp, sizeof(tmp));
return ret;