[FFmpeg-cvslog] lavu/opt: avoid accidentally propagating spurious errors

Anton Khirnov git at videolan.org
Sat Sep 28 18:15:27 EEST 2024


ffmpeg | branch: release/7.1 | Anton Khirnov <anton at khirnov.net> | Thu Sep 26 18:08:04 2024 +0200| [d5c308fcc5576861e42aa0c8897e3a0271a86ff7] | committer: Anton Khirnov

lavu/opt: avoid accidentally propagating spurious errors

An error from read_number() is non-fatal here and should not be
forwarded.

(cherry picked from commit 505fea34e53e0459d1ca6604a3f4737f0b90902c)
Signed-off-by: Anton Khirnov <anton at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d5c308fcc5576861e42aa0c8897e3a0271a86ff7
---

 libavutil/opt.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index 02ed9d9fe9..93f2bb1320 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -2343,13 +2343,15 @@ int av_opt_set_array(void *obj, const char *name, int search_flags,
         int64_t intnum = 1;
 
         if (val_type == TYPE_BASE(o->type)) {
+            int err;
+
             ret = opt_copy_elem(obj, val_type, dst, src);
             if (ret < 0)
                 goto fail;
 
             // validate the range for numeric options
-            ret = read_number(o, dst, &num, &den, &intnum);
-            if (ret >= 0 && TYPE_BASE(o->type) != AV_OPT_TYPE_FLAGS &&
+            err = read_number(o, dst, &num, &den, &intnum);
+            if (err >= 0 && TYPE_BASE(o->type) != AV_OPT_TYPE_FLAGS &&
                 (!den || o->max * den < num * intnum || o->min * den > num * intnum)) {
                 num = den ? num * intnum / den : (num && intnum ? INFINITY : NAN);
                 av_log(obj, AV_LOG_ERROR, "Cannot set array element %u for "



More information about the ffmpeg-cvslog mailing list