[FFmpeg-devel] avcodec/tests/rangecoder: initialize array to avoid valgrind warning

Submitted by Michael Niedermayer on Jan. 4, 2019, 1:46 a.m.

Details

Message ID 20190104014629.1592-1-michael@niedermayer.cc
State Accepted
Commit c15972f0af7679b466dd4a10a54ab2f04f9372c8
Headers show

Commit Message

Michael Niedermayer Jan. 4, 2019, 1:46 a.m.
Found-by: jamrial
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/tests/rangecoder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Steven Liu Jan. 4, 2019, 9:19 a.m.
Michael Niedermayer <michael@niedermayer.cc> 于2019年1月4日周五 上午9:48写道:
>
> Found-by: jamrial
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/tests/rangecoder.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/tests/rangecoder.c b/libavcodec/tests/rangecoder.c
> index b6edc1493f..d6cf9ec380 100644
> --- a/libavcodec/tests/rangecoder.c
> +++ b/libavcodec/tests/rangecoder.c
> @@ -29,7 +29,7 @@
>  int main(void)
>  {
>      RangeCoder c;
> -    uint8_t b[9 * SIZE];
> +    uint8_t b[9 * SIZE] = {0};
Hi Michael,
>      uint8_t r[9 * SIZE];

Why don't initial variable too?

>      int i, p, actual_length, version;
>      uint8_t state[10];
> --
> 2.20.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Michael Niedermayer Jan. 4, 2019, 2:59 p.m.
On Fri, Jan 04, 2019 at 05:19:21PM +0800, Steven Liu wrote:
> Michael Niedermayer <michael@niedermayer.cc> 于2019年1月4日周五 上午9:48写道:
> >
> > Found-by: jamrial
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/tests/rangecoder.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/tests/rangecoder.c b/libavcodec/tests/rangecoder.c
> > index b6edc1493f..d6cf9ec380 100644
> > --- a/libavcodec/tests/rangecoder.c
> > +++ b/libavcodec/tests/rangecoder.c
> > @@ -29,7 +29,7 @@
> >  int main(void)
> >  {
> >      RangeCoder c;
> > -    uint8_t b[9 * SIZE];
> > +    uint8_t b[9 * SIZE] = {0};
> Hi Michael,
> >      uint8_t r[9 * SIZE];
> 
> Why don't initial variable too?

which variable do you mean ? i think i dont understand your comment
r is initialized completely a few lines later

[...]
Michael Niedermayer Jan. 12, 2019, 2:49 p.m.
On Fri, Jan 04, 2019 at 02:46:29AM +0100, Michael Niedermayer wrote:
> Found-by: jamrial
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/tests/rangecoder.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

i intend to apply this soon unless there are more comments, i did not
understand the only comment :(

[...]
Steven Liu Jan. 13, 2019, 8:21 a.m.
> On Jan 12, 2019, at 22:49, Michael Niedermayer <michael@niedermayer.cc> wrote:
> 
> On Fri, Jan 04, 2019 at 02:46:29AM +0100, Michael Niedermayer wrote:
>> Found-by: jamrial
>> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
>> ---
>> libavcodec/tests/rangecoder.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> i intend to apply this soon unless there are more comments, i did not
> understand the only comment :(
Hi Michael,

    Sorry for my comment, i think you are right,
    i mean the r should initialized too, but it have been initialized completely a few lines later.


> 
> [...]
> -- 
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> "I am not trying to be anyone's saviour, I'm trying to think about the
> future and not be sad" - Elon Musk
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Thanks
Steven
Michael Niedermayer Jan. 13, 2019, 5:37 p.m.
On Sun, Jan 13, 2019 at 04:21:14PM +0800, Steven Liu wrote:
> 
> 
> > On Jan 12, 2019, at 22:49, Michael Niedermayer <michael@niedermayer.cc> wrote:
> > 
> > On Fri, Jan 04, 2019 at 02:46:29AM +0100, Michael Niedermayer wrote:
> >> Found-by: jamrial
> >> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> >> ---
> >> libavcodec/tests/rangecoder.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > i intend to apply this soon unless there are more comments, i did not
> > understand the only comment :(
> Hi Michael,
> 
>     Sorry for my comment, i think you are right,
>     i mean the r should initialized too, but it have been initialized completely a few lines later.

will apply

thx

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/tests/rangecoder.c b/libavcodec/tests/rangecoder.c
index b6edc1493f..d6cf9ec380 100644
--- a/libavcodec/tests/rangecoder.c
+++ b/libavcodec/tests/rangecoder.c
@@ -29,7 +29,7 @@ 
 int main(void)
 {
     RangeCoder c;
-    uint8_t b[9 * SIZE];
+    uint8_t b[9 * SIZE] = {0};
     uint8_t r[9 * SIZE];
     int i, p, actual_length, version;
     uint8_t state[10];