diff mbox

[FFmpeg-devel] avcodec/svq1: zero initialize entries array

Message ID 20170409105110.11850-1-jamrial@gmail.com
State Accepted
Commit aed84ee4d1b0c9e315a84b1ee0918fa49ee9cc09
Headers show

Commit Message

James Almer April 9, 2017, 10:51 a.m. UTC
Fixes valgrind warnings about "Use of uninitialised value of size 8"

Signed-off-by: James Almer <jamrial@gmail.com>
---
This probably just silences a bunch of false possitives.

 libavcodec/svq1dec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Kieran Kunhya April 9, 2017, 2:51 p.m. UTC | #1
On Sun, 9 Apr 2017 at 14:57 James Almer <jamrial@gmail.com> wrote:

> Fixes valgrind warnings about "Use of uninitialised value of size 8"
>
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> This probably just silences a bunch of false possitives.
>
>  libavcodec/svq1dec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>

LGTM
James Almer April 9, 2017, 4:39 p.m. UTC | #2
On 4/9/2017 11:51 AM, Kieran Kunhya wrote:
> On Sun, 9 Apr 2017 at 14:57 James Almer <jamrial@gmail.com> wrote:
> 
>> Fixes valgrind warnings about "Use of uninitialised value of size 8"
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>> This probably just silences a bunch of false possitives.
>>
>>  libavcodec/svq1dec.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
> 
> LGTM

Pushed, thanks.
Michael Niedermayer April 10, 2017, 1:46 a.m. UTC | #3
On Sun, Apr 09, 2017 at 07:51:10AM -0300, James Almer wrote:
> Fixes valgrind warnings about "Use of uninitialised value of size 8"

how can this be reproduced ?
is this a regression ?


> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---

> This probably just silences a bunch of false possitives.

if thats the case, then the fix is wrong
valgrind bugs should be fixed in valgrind or the entries should be
added to the valgrind suppression file

[...]
James Almer April 10, 2017, 2:10 a.m. UTC | #4
On 4/9/2017 10:46 PM, Michael Niedermayer wrote:
> On Sun, Apr 09, 2017 at 07:51:10AM -0300, James Almer wrote:
>> Fixes valgrind warnings about "Use of uninitialised value of size 8"
> 
> how can this be reproduced ?

fate-svq1, fate-svq1-headerswap and fate-vsynth{1,2,3,_lena}-svq1 when
configured with --toolchain=valgrind-memcheck

A similar failure can be seen in all ffv1 vsynth tests as well, but i
couldn't find what caused them or where.

> is this a regression ?

Fate didn't always complain about this, so it's either something
introduced by a change in our tree, or a valgrind bug introduced in a
relatively recent version.

The reports in
http://fate.ffmpeg.org/history.cgi?slot=x86_64-archlinux-gcc-valgrindundef
are kinda broken and report a nonsense commit as the "last known good
ref", so i can't say when it started failing.

> 
> 
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
> 
>> This probably just silences a bunch of false possitives.
> 
> if thats the case, then the fix is wrong
> valgrind bugs should be fixed in valgrind or the entries should be
> added to the valgrind suppression file

Assuming it is after all a false positive, zero initializing stack is
harmless and gets rid of the noise. But i agree it's not ideal.

> 
> [...]
> 
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
Clément Bœsch April 10, 2017, 6:02 a.m. UTC | #5
On Sun, Apr 09, 2017 at 11:10:16PM -0300, James Almer wrote:
[...]
> > is this a regression ?
> 
> Fate didn't always complain about this, so it's either something
> introduced by a change in our tree, or a valgrind bug introduced in a
> relatively recent version.
> 

> The reports in
> http://fate.ffmpeg.org/history.cgi?slot=x86_64-archlinux-gcc-valgrindundef
> are kinda broken and report a nonsense commit as the "last known good
> ref", so i can't say when it started failing.

That was because I couldn't upgrade for a long time and bumped both GCC
and Valgrind (and actually the whole system) at once. Sorry, I couldn't do
it gradually.
Michael Niedermayer April 10, 2017, 11:37 a.m. UTC | #6
On Mon, Apr 10, 2017 at 08:02:34AM +0200, Clément Bœsch wrote:
> On Sun, Apr 09, 2017 at 11:10:16PM -0300, James Almer wrote:
> [...]
> > > is this a regression ?
> > 
> > Fate didn't always complain about this, so it's either something
> > introduced by a change in our tree, or a valgrind bug introduced in a
> > relatively recent version.
> > 
> 
> > The reports in
> > http://fate.ffmpeg.org/history.cgi?slot=x86_64-archlinux-gcc-valgrindundef
> > are kinda broken and report a nonsense commit as the "last known good
> > ref", so i can't say when it started failing.
> 
> That was because I couldn't upgrade for a long time and bumped both GCC
> and Valgrind (and actually the whole system) at once. Sorry, I couldn't do
> it gradually.

does your fate client have optimizations enabled ?
i dont see them being disabled, and iam not sure valgrind + full
compiler optimizations are a good idea

if they are enabled, please try to disable them to check if that
causes the false positives

my local valgrind shows nothing for svq1

[...]
Clément Bœsch April 10, 2017, 12:04 p.m. UTC | #7
On Mon, Apr 10, 2017 at 01:37:54PM +0200, Michael Niedermayer wrote:
> On Mon, Apr 10, 2017 at 08:02:34AM +0200, Clément Bœsch wrote:
> > On Sun, Apr 09, 2017 at 11:10:16PM -0300, James Almer wrote:
> > [...]
> > > > is this a regression ?
> > > 
> > > Fate didn't always complain about this, so it's either something
> > > introduced by a change in our tree, or a valgrind bug introduced in a
> > > relatively recent version.
> > > 
> > 
> > > The reports in
> > > http://fate.ffmpeg.org/history.cgi?slot=x86_64-archlinux-gcc-valgrindundef
> > > are kinda broken and report a nonsense commit as the "last known good
> > > ref", so i can't say when it started failing.
> > 
> > That was because I couldn't upgrade for a long time and bumped both GCC
> > and Valgrind (and actually the whole system) at once. Sorry, I couldn't do
> > it gradually.
> 
> does your fate client have optimizations enabled ?
> i dont see them being disabled, and iam not sure valgrind + full
> compiler optimizations are a good idea
> 
> if they are enabled, please try to disable them to check if that
> causes the false positives
> 

Yeah actually, only --extra-cflags=-fno-tree-vectorize is needed to make
fate-vsynth3-svq1 pass. I thought it was supposed to be disabled?

> my local valgrind shows nothing for svq1

With aed84ee4d reverted? --toolchain=valgrind-memcheck
--disable-stripping?
Michael Niedermayer April 10, 2017, 12:19 p.m. UTC | #8
On Mon, Apr 10, 2017 at 02:04:30PM +0200, Clément Bœsch wrote:
> On Mon, Apr 10, 2017 at 01:37:54PM +0200, Michael Niedermayer wrote:
> > On Mon, Apr 10, 2017 at 08:02:34AM +0200, Clément Bœsch wrote:
> > > On Sun, Apr 09, 2017 at 11:10:16PM -0300, James Almer wrote:
> > > [...]
> > > > > is this a regression ?
> > > > 
> > > > Fate didn't always complain about this, so it's either something
> > > > introduced by a change in our tree, or a valgrind bug introduced in a
> > > > relatively recent version.
> > > > 
> > > 
> > > > The reports in
> > > > http://fate.ffmpeg.org/history.cgi?slot=x86_64-archlinux-gcc-valgrindundef
> > > > are kinda broken and report a nonsense commit as the "last known good
> > > > ref", so i can't say when it started failing.
> > > 
> > > That was because I couldn't upgrade for a long time and bumped both GCC
> > > and Valgrind (and actually the whole system) at once. Sorry, I couldn't do
> > > it gradually.
> > 
> > does your fate client have optimizations enabled ?
> > i dont see them being disabled, and iam not sure valgrind + full
> > compiler optimizations are a good idea
> > 
> > if they are enabled, please try to disable them to check if that
> > causes the false positives
> > 
> 
> Yeah actually, only --extra-cflags=-fno-tree-vectorize is needed to make
> fate-vsynth3-svq1 pass. I thought it was supposed to be disabled?
> 
> > my local valgrind shows nothing for svq1
> 

> With aed84ee4d reverted? --toolchain=valgrind-memcheck
> --disable-stripping?

reverted, yes
no toolchain, no stripping just tried it under valgrind

but thats with a relativly old gcc

[...]
Clément Bœsch April 10, 2017, 12:42 p.m. UTC | #9
On Mon, Apr 10, 2017 at 02:19:54PM +0200, Michael Niedermayer wrote:
> On Mon, Apr 10, 2017 at 02:04:30PM +0200, Clément Bœsch wrote:
> > On Mon, Apr 10, 2017 at 01:37:54PM +0200, Michael Niedermayer wrote:
> > > On Mon, Apr 10, 2017 at 08:02:34AM +0200, Clément Bœsch wrote:
> > > > On Sun, Apr 09, 2017 at 11:10:16PM -0300, James Almer wrote:
> > > > [...]
> > > > > > is this a regression ?
> > > > > 
> > > > > Fate didn't always complain about this, so it's either something
> > > > > introduced by a change in our tree, or a valgrind bug introduced in a
> > > > > relatively recent version.
> > > > > 
> > > > 
> > > > > The reports in
> > > > > http://fate.ffmpeg.org/history.cgi?slot=x86_64-archlinux-gcc-valgrindundef
> > > > > are kinda broken and report a nonsense commit as the "last known good
> > > > > ref", so i can't say when it started failing.
> > > > 
> > > > That was because I couldn't upgrade for a long time and bumped both GCC
> > > > and Valgrind (and actually the whole system) at once. Sorry, I couldn't do
> > > > it gradually.
> > > 
> > > does your fate client have optimizations enabled ?
> > > i dont see them being disabled, and iam not sure valgrind + full
> > > compiler optimizations are a good idea
> > > 
> > > if they are enabled, please try to disable them to check if that
> > > causes the false positives
> > > 
> > 
> > Yeah actually, only --extra-cflags=-fno-tree-vectorize is needed to make
> > fate-vsynth3-svq1 pass. I thought it was supposed to be disabled?
> > 
> > > my local valgrind shows nothing for svq1
> > 
> 
> > With aed84ee4d reverted? --toolchain=valgrind-memcheck
> > --disable-stripping?
> 
> reverted, yes
> no toolchain, no stripping just tried it under valgrind
> 
> but thats with a relativly old gcc
> 

Actually i was wrong: the GCC option that makes valgrind go crazy is
unswitch-loops, not tree-vectorize. Do you have it in your GCC?
Michael Niedermayer April 10, 2017, 12:48 p.m. UTC | #10
On Mon, Apr 10, 2017 at 02:42:42PM +0200, Clément Bœsch wrote:
> On Mon, Apr 10, 2017 at 02:19:54PM +0200, Michael Niedermayer wrote:
> > On Mon, Apr 10, 2017 at 02:04:30PM +0200, Clément Bœsch wrote:
> > > On Mon, Apr 10, 2017 at 01:37:54PM +0200, Michael Niedermayer wrote:
> > > > On Mon, Apr 10, 2017 at 08:02:34AM +0200, Clément Bœsch wrote:
> > > > > On Sun, Apr 09, 2017 at 11:10:16PM -0300, James Almer wrote:
> > > > > [...]
> > > > > > > is this a regression ?
> > > > > > 
> > > > > > Fate didn't always complain about this, so it's either something
> > > > > > introduced by a change in our tree, or a valgrind bug introduced in a
> > > > > > relatively recent version.
> > > > > > 
> > > > > 
> > > > > > The reports in
> > > > > > http://fate.ffmpeg.org/history.cgi?slot=x86_64-archlinux-gcc-valgrindundef
> > > > > > are kinda broken and report a nonsense commit as the "last known good
> > > > > > ref", so i can't say when it started failing.
> > > > > 
> > > > > That was because I couldn't upgrade for a long time and bumped both GCC
> > > > > and Valgrind (and actually the whole system) at once. Sorry, I couldn't do
> > > > > it gradually.
> > > > 
> > > > does your fate client have optimizations enabled ?
> > > > i dont see them being disabled, and iam not sure valgrind + full
> > > > compiler optimizations are a good idea
> > > > 
> > > > if they are enabled, please try to disable them to check if that
> > > > causes the false positives
> > > > 
> > > 
> > > Yeah actually, only --extra-cflags=-fno-tree-vectorize is needed to make
> > > fate-vsynth3-svq1 pass. I thought it was supposed to be disabled?
> > > 
> > > > my local valgrind shows nothing for svq1
> > > 
> > 
> > > With aed84ee4d reverted? --toolchain=valgrind-memcheck
> > > --disable-stripping?
> > 
> > reverted, yes
> > no toolchain, no stripping just tried it under valgrind
> > 
> > but thats with a relativly old gcc
> > 
> 
> Actually i was wrong: the GCC option that makes valgrind go crazy is
> unswitch-loops, not tree-vectorize. Do you have it in your GCC?

its in man gcc on the box i tried on.
maybe gcc has improved between version 4 an 6
but it doesnt really matter

if it fixes all the false positives, please add it and then lets
revert the workaround (s?)

thx

[...]
Clément Bœsch April 10, 2017, 2:10 p.m. UTC | #11
On Mon, Apr 10, 2017 at 02:48:51PM +0200, Michael Niedermayer wrote:
> On Mon, Apr 10, 2017 at 02:42:42PM +0200, Clément Bœsch wrote:
> > On Mon, Apr 10, 2017 at 02:19:54PM +0200, Michael Niedermayer wrote:
> > > On Mon, Apr 10, 2017 at 02:04:30PM +0200, Clément Bœsch wrote:
> > > > On Mon, Apr 10, 2017 at 01:37:54PM +0200, Michael Niedermayer wrote:
> > > > > On Mon, Apr 10, 2017 at 08:02:34AM +0200, Clément Bœsch wrote:
> > > > > > On Sun, Apr 09, 2017 at 11:10:16PM -0300, James Almer wrote:
> > > > > > [...]
> > > > > > > > is this a regression ?
> > > > > > > 
> > > > > > > Fate didn't always complain about this, so it's either something
> > > > > > > introduced by a change in our tree, or a valgrind bug introduced in a
> > > > > > > relatively recent version.
> > > > > > > 
> > > > > > 
> > > > > > > The reports in
> > > > > > > http://fate.ffmpeg.org/history.cgi?slot=x86_64-archlinux-gcc-valgrindundef
> > > > > > > are kinda broken and report a nonsense commit as the "last known good
> > > > > > > ref", so i can't say when it started failing.
> > > > > > 
> > > > > > That was because I couldn't upgrade for a long time and bumped both GCC
> > > > > > and Valgrind (and actually the whole system) at once. Sorry, I couldn't do
> > > > > > it gradually.
> > > > > 
> > > > > does your fate client have optimizations enabled ?
> > > > > i dont see them being disabled, and iam not sure valgrind + full
> > > > > compiler optimizations are a good idea
> > > > > 
> > > > > if they are enabled, please try to disable them to check if that
> > > > > causes the false positives
> > > > > 
> > > > 
> > > > Yeah actually, only --extra-cflags=-fno-tree-vectorize is needed to make
> > > > fate-vsynth3-svq1 pass. I thought it was supposed to be disabled?
> > > > 
> > > > > my local valgrind shows nothing for svq1
> > > > 
> > > 
> > > > With aed84ee4d reverted? --toolchain=valgrind-memcheck
> > > > --disable-stripping?
> > > 
> > > reverted, yes
> > > no toolchain, no stripping just tried it under valgrind
> > > 
> > > but thats with a relativly old gcc
> > > 
> > 
> > Actually i was wrong: the GCC option that makes valgrind go crazy is
> > unswitch-loops, not tree-vectorize. Do you have it in your GCC?
> 
> its in man gcc on the box i tried on.
> maybe gcc has improved between version 4 an 6
> but it doesnt really matter
> 
> if it fixes all the false positives, please add it and then lets
> revert the workaround (s?)
> 

I reverted and I'm in the process of reporting to valgrind.
Clément Bœsch April 10, 2017, 2:14 p.m. UTC | #12
On Mon, Apr 10, 2017 at 04:10:14PM +0200, Clément Bœsch wrote:
> I reverted and I'm in the process of reporting to valgrind.

Here you go:
https://bugs.kde.org/show_bug.cgi?id=378622
Michael Niedermayer April 10, 2017, 2:34 p.m. UTC | #13
On Mon, Apr 10, 2017 at 04:14:44PM +0200, Clément Bœsch wrote:
> On Mon, Apr 10, 2017 at 04:10:14PM +0200, Clément Bœsch wrote:
> > I reverted and I'm in the process of reporting to valgrind.
> 
> Here you go:
> https://bugs.kde.org/show_bug.cgi?id=378622

Thanks!

[...]
diff mbox

Patch

diff --git a/libavcodec/svq1dec.c b/libavcodec/svq1dec.c
index d3e60c3a4a..e5e43fc8e2 100644
--- a/libavcodec/svq1dec.c
+++ b/libavcodec/svq1dec.c
@@ -160,7 +160,7 @@  static int svq1_decode_block_intra(GetBitContext *bitbuf, uint8_t *pixels,
     uint8_t *list[63];
     uint32_t *dst;
     const uint32_t *codebook;
-    int entries[6];
+    int entries[6] = { 0 };
     int i, j, m, n;
     int stages;
     unsigned mean;
@@ -227,7 +227,7 @@  static int svq1_decode_block_non_intra(GetBitContext *bitbuf, uint8_t *pixels,
     uint8_t *list[63];
     uint32_t *dst;
     const uint32_t *codebook;
-    int entries[6];
+    int entries[6] = { 0 };
     int i, j, m, n;
     int stages;
     unsigned mean;