[FFmpeg-devel] [PATCH] avutil: Added selftest for libavutil/audio_fifo.c

Michael Niedermayer michael at niedermayer.cc
Thu Dec 22 04:08:53 EET 2016


On Wed, Dec 21, 2016 at 10:53:36PM -0300, James Almer wrote:
> On 12/21/2016 10:49 PM, Michael Niedermayer wrote:
> > On Wed, Dec 21, 2016 at 09:45:39PM -0300, James Almer wrote:
> >> On 12/20/2016 11:36 PM, Michael Niedermayer wrote:
> >>> On Tue, Dec 20, 2016 at 04:53:51PM -0800, Thomas Turner wrote:
> >>>> Signed-off-by: Thomas Turner <thomastdt at googlemail.com>
> >>>> ---
> >>>>  libavutil/Makefile           |   1 +
> >>>>  libavutil/tests/audio_fifo.c | 196 +++++++++++++++++++++++++++++++++++++
> >>>>  tests/fate/libavutil.mak     |   4 +
> >>>>  tests/ref/fate/audio_fifo    | 228 +++++++++++++++++++++++++++++++++++++++++++
> >>>>  4 files changed, 429 insertions(+)
> >>>>  create mode 100644 libavutil/tests/audio_fifo.c
> >>>>  create mode 100644 tests/ref/fate/audio_fifo
> >>>
> >>> applied
> >>>
> >>> thx
> >>
> >> This is crashing on some fate clients.
> >>
> >> I noticed it's using malloc and free instead of the av_malloc family,
> >> so maybe it's related to that?
> >> Patch attached in any case, it's proper even if not the reason behind
> >> the crashes.
> > 
> > i saw the malloc/free before applying. It seemed to make sense to
> > use libc functions in a test of our public API
> > 
> > why is it crashing ?
> 
> I don't know, i can't reproduce it. Seems to be OpenBSD FATE clients only
> as far as i could see.

no openbsd needed, valgrind shows these errors
Thomas, can you look at this ?

TEST: 1

written: 12
written: 12
remaining samples in audio_fifo: 24

==32011== Invalid write of size 8
==32011==    at 0x4016B2: read_samples_from_audio_fifo (audio_fifo.c:92)
==32011==    by 0x4018C6: test_function (audio_fifo.c:141)
==32011==    by 0x401AE2: main (audio_fifo.c:193)
==32011==  Address 0x540f040 is 0 bytes after a block of size 0 alloc'd
==32011==    at 0x4C2C66F: malloc (vg_replace_malloc.c:270)
==32011==    by 0x4014E5: allocate_memory (audio_fifo.c:55)
==32011==    by 0x401674: read_samples_from_audio_fifo (audio_fifo.c:88)
==32011==    by 0x4018C6: test_function (audio_fifo.c:141)
==32011==    by 0x401AE2: main (audio_fifo.c:193)
==32011==
==32011== Invalid read of size 8
==32011==    at 0x401320: av_audio_fifo_read (audio_fifo.c:193)
==32011==    by 0x4016DD: read_samples_from_audio_fifo (audio_fifo.c:95)
==32011==    by 0x4018C6: test_function (audio_fifo.c:141)
==32011==    by 0x401AE2: main (audio_fifo.c:193)
==32011==  Address 0x540f040 is 0 bytes after a block of size 0 alloc'd
==32011==    at 0x4C2C66F: malloc (vg_replace_malloc.c:270)
==32011==    by 0x4014E5: allocate_memory (audio_fifo.c:55)
==32011==    by 0x401674: read_samples_from_audio_fifo (audio_fifo.c:88)
==32011==    by 0x4018C6: test_function (audio_fifo.c:141)
==32011==    by 0x401AE2: main (audio_fifo.c:193)
==32011==
read: 12
==32011== Invalid read of size 8
==32011==    at 0x4015A8: print_audio_bytes (audio_fifo.c:74)
==32011==    by 0x401900: test_function (audio_fifo.c:146)
==32011==    by 0x401AE2: main (audio_fifo.c:193)
==32011==  Address 0x540f040 is 0 bytes after a block of size 0 alloc'd
==32011==    at 0x4C2C66F: malloc (vg_replace_malloc.c:270)
==32011==    by 0x4014E5: allocate_memory (audio_fifo.c:55)
==32011==    by 0x401674: read_samples_from_audio_fifo (audio_fifo.c:88)
==32011==    by 0x4018C6: test_function (audio_fifo.c:141)
==32011==    by 0x401AE2: main (audio_fifo.c:193)
==32011==
00 01 02 03 04 05 06 07 08 09 0a 0b
remaining samples in audio_fifo: 12

==32011== Invalid read of size 8
==32011==    at 0x401164: av_audio_fifo_peek (audio_fifo.c:150)
==32011==    by 0x401937: test_function (audio_fifo.c:150)
==32011==    by 0x401AE2: main (audio_fifo.c:193)
==32011==  Address 0x540f040 is 0 bytes after a block of size 0 alloc'd
==32011==    at 0x4C2C66F: malloc (vg_replace_malloc.c:270)
==32011==    by 0x4014E5: allocate_memory (audio_fifo.c:55)
==32011==    by 0x401674: read_samples_from_audio_fifo (audio_fifo.c:88)
==32011==    by 0x4018C6: test_function (audio_fifo.c:141)
==32011==    by 0x401AE2: main (audio_fifo.c:193)
==32011==
peek:
==32011== Invalid read of size 8
==32011==    at 0x4015A8: print_audio_bytes (audio_fifo.c:74)
==32011==    by 0x401967: test_function (audio_fifo.c:155)
==32011==    by 0x401AE2: main (audio_fifo.c:193)
==32011==  Address 0x540f040 is 0 bytes after a block of size 0 alloc'd
==32011==    at 0x4C2C66F: malloc (vg_replace_malloc.c:270)
==32011==    by 0x4014E5: allocate_memory (audio_fifo.c:55)
==32011==    by 0x401674: read_samples_from_audio_fifo (audio_fifo.c:88)
==32011==    by 0x4018C6: test_function (audio_fifo.c:141)
==32011==    by 0x401AE2: main (audio_fifo.c:193)
==32011==
00 01 02 03 04 05 06 07 08 09 0a 0b

peek_at:
==32011== Invalid read of size 8
==32011==    at 0x401264: av_audio_fifo_peek_at (audio_fifo.c:174)
==32011==    by 0x40199E: test_function (audio_fifo.c:161)
==32011==    by 0x401AE2: main (audio_fifo.c:193)
==32011==  Address 0x540f040 is 0 bytes after a block of size 0 alloc'd
==32011==    at 0x4C2C66F: malloc (vg_replace_malloc.c:270)
==32011==    by 0x4014E5: allocate_memory (audio_fifo.c:55)
==32011==    by 0x401674: read_samples_from_audio_fifo (audio_fifo.c:88)
==32011==    by 0x4018C6: test_function (audio_fifo.c:141)
==32011==    by 0x401AE2: main (audio_fifo.c:193)
==32011==
0:
==32011== Invalid read of size 8
==32011==    at 0x4015A8: print_audio_bytes (audio_fifo.c:74)
==32011==    by 0x4019D8: test_function (audio_fifo.c:166)
==32011==    by 0x401AE2: main (audio_fifo.c:193)
==32011==  Address 0x540f040 is 0 bytes after a block of size 0 alloc'd
==32011==    at 0x4C2C66F: malloc (vg_replace_malloc.c:270)
==32011==    by 0x4014E5: allocate_memory (audio_fifo.c:55)
==32011==    by 0x401674: read_samples_from_audio_fifo (audio_fifo.c:88)
==32011==    by 0x4018C6: test_function (audio_fifo.c:141)
==32011==    by 0x401AE2: main (audio_fifo.c:193)
==32011==
00
1:
01
2:
02
3:
03
4:
04
5:
05
6:
06
7:
07
8:
08
9:
09
10:
0a
11:
0b

==32011== Invalid read of size 8
==32011==    at 0x401A4A: test_function (audio_fifo.c:181)
==32011==    by 0x401AE2: main (audio_fifo.c:193)
==32011==  Address 0x540f040 is 0 bytes after a block of size 0 alloc'd
==32011==    at 0x4C2C66F: malloc (vg_replace_malloc.c:270)
==32011==    by 0x4014E5: allocate_memory (audio_fifo.c:55)
==32011==    by 0x401674: read_samples_from_audio_fifo (audio_fifo.c:88)
==32011==    by 0x4018C6: test_function (audio_fifo.c:141)
==32011==    by 0x401AE2: main (audio_fifo.c:193)
==32011==

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20161222/64cad211/attachment.sig>


More information about the ffmpeg-devel mailing list