Commit 8548a40fc9 for ffmpeg
commit 8548a40fc9d17c5caca869c014d2d45e55c5ea22
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Mon Oct 12 02:01:35 2026 +0200
avutil/opt: do not store an image size that failed to parse
Fixes: use of uninitialized memory
Fixes: yEDlrREdlez4
Regression since: bd68a61304
Found during 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 03fca6ad15..041ad30280 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -534,8 +534,10 @@ static int set_string_image_size(void *obj, const AVOption *o, const char *val,
return 0;
}
ret = av_parse_video_size(&tmp[0], &tmp[1], val);
- if (ret < 0)
+ if (ret < 0) {
av_log(logctx, AV_LOG_ERROR, "Unable to parse \"%s\" option value \"%s\" as image size\n", o->name, val);
+ return ret;
+ }
if (dst)
memcpy(dst, tmp, sizeof(tmp));
return ret;