diff mbox series

[FFmpeg-devel] lavu/opt: Fix return of uninitialised value

Message ID D3R564MA774W.GHE7TSWE2LL2@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel] lavu/opt: Fix return of uninitialised value | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Marvin Scholz Aug. 28, 2024, 1:08 a.m. UTC
In one of the failure paths of av_opt_get_array, the ret variable
was accidentally declared again, shadowing the outer one and once when
jumping to the fail label would return the still uninitialised outer
one.

To fix this simply remove the local declaration of ret that shadowed
the outer one.

Introduced in d89930f8666c563a96f1dc1835b450522b4cd6da

Fixes: CID1618663 Uninitialized scalar variable
---
 libavutil/opt.c | 1 -
 1 file changed, 1 deletion(-)


base-commit: d89930f8666c563a96f1dc1835b450522b4cd6da

Comments

Anton Khirnov Aug. 28, 2024, 2:48 p.m. UTC | #1
Quoting Marvin Scholz (2024-08-28 03:08:39)
> In one of the failure paths of av_opt_get_array, the ret variable
> was accidentally declared again, shadowing the outer one and once when
> jumping to the fail label would return the still uninitialised outer
> one.
> 
> To fix this simply remove the local declaration of ret that shadowed
> the outer one.
> 
> Introduced in d89930f8666c563a96f1dc1835b450522b4cd6da
> 
> Fixes: CID1618663 Uninitialized scalar variable
> ---
>  libavutil/opt.c | 1 -
>  1 file changed, 1 deletion(-)

Looks ok, thanks.
diff mbox series

Patch

diff --git a/libavutil/opt.c b/libavutil/opt.c
index d515e20e97..3788a9df75 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -2213,7 +2213,6 @@  int av_opt_get_array(void *obj, const char *name, int search_flags,
             double     num = 1.0;
             int        den = 1;
             int64_t intnum = 1;
-            int ret;
 
             ret = read_number(o, src, &num, &den, &intnum);
             if (ret < 0)