libsndfile/sndfile-tools

Error when generating images with very large size.

Closed this issue · 2 comments

I put the wav file that is failing on S3.

https://s3.amazonaws.com/randomz/6722ccba-f179-11e1-be45-0800270e481f.wav

sndfile-waveform -B 0x00000000 -F 0xFF000000 -g 16010x50 /tmp/audio/6722ccba-f179-11e1-be45-0800270e481f.wav /tmp/waveforms/6722ccba-f179-11e1-be45-0800270e481f.png

It seems to be caused by some combination of wav file length, and image size. If you reduce the width of the above by 1000 px it doesn't throw the error.

Also I tried the same parameters on a different audio file and it didn't throw the error.

Here's the error:

*** glibc detected *** sndfile-waveform: double free or corruption (!prev): 0x0000000000b46670 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7e626)[0x7f0ed915e626]
sndfile-waveform[0x40493f]
sndfile-waveform[0x401ce2]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7f0ed910176d]
sndfile-waveform[0x401d6d]
======= Memory map: ========
00400000-00408000 r-xp 00000000 fc:00 36375 /usr/local/bin/sndfile-waveform
00607000-00608000 r--p 00007000 fc:00 36375 /usr/local/bin/sndfile-waveform
00608000-00609000 rw-p 00008000 fc:00 36375 /usr/local/bin/sndfile-waveform
00609000-0060d000 rw-p 00000000 00:00 0
00b35000-00b7d000 rw-p 00000000 00:00 0 [heap]
7f0ed5a86000-7f0ed5a9b000 r-xp 00000000 fc:00 753 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f0ed5a9b000-7f0ed5c9a000 ---p 00015000 fc:00 753 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f0ed5c9a000-7f0ed5c9b000 r--p 00014000 fc:00 753 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f0ed5c9b000-7f0ed5c9c000 rw-p 00015000 fc:00 753 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f0ed5c9c000-7f0ed643f000 rw-p 00000000 00:00 0
7f0ed643f000-7f0ed6441000 r-xp 00000000 fc:00 986 /lib/x86_64-linux-gnu/libdl-2.15.so
7f0ed6441000-7f0ed6641000 ---p 00002000 fc:00 986 /lib/x86_64-linux-gnu/libdl-2.15.so
7f0ed6641000-7f0ed6642000 r--p 00002000 fc:00 986 /lib/x86_64-linux-gnu/libdl-2.15.so
7f0ed6642000-7f0ed6643000 rw-p 00003000 fc:00 986 /lib/x86_64-linux-gnu/libdl-2.15.so
7f0ed6643000-7f0ed6648000 r-xp 00000000 fc:00 18225 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
7f0ed6648000-7f0ed6847000 ---p 00005000 fc:00 18225 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
7f0ed6847000-7f0ed6848000 r--p 00004000 fc:00 18225 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
7f0ed6848000-7f0ed6849000 rw-p 00005000 fc:00 18225 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
7f0ed6849000-7f0ed684b000 r-xp 00000000 fc:00 18223 /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
7f0ed684b000-7f0ed6a4a000 ---p 00002000 fc:00 18223 /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
7f0ed6a4a000-7f0ed6a4b000 r--p 00001000 fc:00 18223 /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
7f0ed6a4b000-7f0ed6a4c000 rw-p 00002000 fc:00 18223 /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
7f0ed6a4c000-7f0ed6a73000 r-xp 00000000 fc:00 5869 /lib/x86_64-linux-gnu/libexpat.so.1.5.2
7f0ed6a73000-7f0ed6c73000 ---p 00027000 fc:00 5869 /lib/x86_64-linux-gnu/libexpat.so.1.5.2
7f0ed6c73000-7f0ed6c75000 r--p 00027000 fc:00 5869 /lib/x86_64-linux-gnu/libexpat.so.1.5.2
7f0ed6c75000-7f0ed6c76000 rw-p 00029000 fc:00 5869 /lib/x86_64-linux-gnu/libexpat.so.1.5.2
7f0ed6c76000-7f0ed6c8c000 r-xp 00000000 fc:00 4871 /lib/x86_64-linux-gnu/libz.so.1.2.3.4
7f0ed6c8c000-7f0ed6e8b000 ---p 00016000 fc:00 4871 /lib/x86_64-linux-gnu/libz.so.1.2.3.4
7f0ed6e8b000-7f0ed6e8c000 r--p 00015000 fc:00 4871 /lib/x86_64-linux-gnu/libz.so.1.2.3.4
7f0ed6e8c000-7f0ed6e8d000 rw-p 00016000 fc:00 4871 /lib/x86_64-linux-gnu/libz.so.1.2.3.4
7f0ed6e8d000-7f0ed6fbc000 r-xp 00000000 fc:00 18232 /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0
7f0ed6fbc000-7f0ed71bc000 ---p 0012f000 fc:00 18232 /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0
7f0ed71bc000-7f0ed71bd000 r--p 0012f000 fc:00 18232 /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0
7f0ed71bd000-7f0ed71c1000 rw-p 00130000 fc:00 18232 /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0
7f0ed71c1000-7f0ed71ca000 r-xp 00000000 fc:00 29816 /usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0
7f0ed71ca000-7f0ed73c9000 ---p 00009000 fc:00 29816 /usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0
7f0ed73c9000-7f0ed73ca000 r--p 00008000 fc:00 29816 /usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0
7f0ed73ca000-7f0ed73cb000 rw-p 00009000 fc:00 29816 /usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0
7f0ed73cb000-7f0ed73e8000 r-xp 00000000 fc:00 765 /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0
7f0ed73e8000-7f0ed75e7000 ---p 0001d000 fc:00 765 /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0
7f0ed75e7000-7f0ed75e8000 r--p 0001c000 fc:00 765 /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0
7f0ed75e8000-7f0ed75e9000 rw-p 0001d000 fc:00 765 /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0
7f0ed75e9000-7f0ed75f1000 r-xp 00000000 fc:00 34130 /usr/lib/x86_64-linux-gnu/libxcb-render.so.0.0.0
7f0ed75f1000-7f0ed77f1000 ---p 00008000 fc:00 34130 /usr/lib/x86_64-linux-gnu/libxcb-render.so.0.0.0
7f0ed77f1000-7f0ed77f2000 r--p 00008000 fc:00 34130 /usr/lib/x86_64-linux-gnu/libxcb-render.so.0.0.0
7f0ed77f2000-7f0ed77f3000 rw-p 00009000 fc:00 34130 /usr/lib/x86_64-linux-gnu/libxcb-render.so.0.0.0
7f0ed77f3000-7f0ed77f5000 r-xp 00000000 fc:00 29805 /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0.0.0
7f0ed77f5000-7f0ed79f4000 ---p 00002000 fc:00 29805 /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0.0.0
7f0ed79f4000-7f0ed79f5000 r--p 00001000 fc:00 29805 /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0.0.0
7f0ed79f5000-7f0ed79f6000 rw-p 00002000 fc:00 29805 /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0.0.0
7f0ed79f6000-7f0ed7a1c000 r-xp 00000000 fc:00 1560 /lib/x86_64-linux-gnu/libpng12.so.0.46.0
7f0ed7a1c000-7f0ed7c1c000 ---p 00026000 fc:00 1560 /lib/x86_64-linux-gnu/libpng12.so.0.46.0
7f0ed7c1c000-7f0ed7c1d000 r--p 00026000 fc:00 1560 /lib/x86_64-linux-gnu/libpng12.so.0.46.0
7f0ed7c1d000-7f0ed7c1e000 rw-p 00027000 fc:00 1560 /lib/x86_64-linux-gnu/libpng12.so.0.46.0
7f0ed7c1e000-7f0ed7cb4000 r-xp 00000000 fc:00 16399 /usr/lib/x86_64-linux-gnu/libfreetype.so.6.8.0
7f0ed7cb4000-7f0ed7eb3000 ---p 00096000 fc:00 16399 /usr/lib/x86_64-linux-gnu/libfreetype.so.6.8.0
7f0ed7eb3000-7f0ed7eb9000 r--p 00095000 fc:00 16399 /usr/lib/x86_64-linux-gnu/libfreetype.so.6.8.0
7f0ed7eb9000-7f0ed7eba000 rw-p 0009b000 fc:00 16399 /usr/lib/x86_64-linux-gnu/libfreetype.so.6.8.0
7f0ed7eba000-7f0ed7eee000 r-xp 00000000 fc:00 29791 /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.4.4
7f0ed7eee000-7f0ed80ee000 ---p 00034000 fc:00 29791 /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.4.4
7f0ed80ee000-7f0ed80ef000 r--p 00034000 fc:00 29791 /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.4.4
7f0ed80ef000-7f0ed80f0000 rw-p 00035000 fc:00 29791 /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.4.4
7f0ed80f0000-7f0ed8171000 r-xp 00000000 fc:00 29801 /usr/lib/x86_64-linux-gnu/libpixman-1.so.0.24.4
7f0ed8171000-7f0ed8370000 ---p 00081000 fc:00 29801 /usr/lib/x86_64-linux-gnu/libpixman-1.so.0.24.4
7f0ed8370000-7f0ed8376000 r--p 00080000 fc:00 29801 /usr/lib/x86_64-linux-gnu/libpixman-1.so.0.24.4
7f0ed8376000-7f0ed8377000 rw-p 00086000 fc:00 29801 /usr/lib/x86_64-linux-gnu/libpixman-1.so.0.24.4
7f0ed8377000-7f0ed838f000 r-xp 00000000 fc:00 990 /lib/x86_64-linux-gnu/libpthread-2.15.so
7f0ed838f000-7f0ed858e000 ---p 00018000 fc:00 990 /lib/x86_64-linux-gnu/libpthread-2.15.so
7f0ed858e000-7f0ed858f000 r--p 00017000 fc:00 990 /lib/x86_64-linux-gnu/libpthread-2.15.so
7f0ed858f000-7f0ed8590000 rw-p 00018000 fc:00 990 /lib/x86_64-linux-gnu/libpthread-2.15.so
7f0ed8590000-7f0ed8594000 rw-p 00000000 00:00 0
7f0ed8594000-7f0ed859a000 r-xp 00000000 fc:00 27378 /usr/lib/x86_64-linux-gnu/libogg.so.0.7.1
7f0ed859a000-7f0ed8799000 ---p 00006000 fc:00 27378 /usr/lib/x86_64-linux-gnu/libogg.so.0.7.1
7f0ed8799000-7f0ed879a000 r--p 00005000 fc:00 27378 /usr/lib/x86_64-linux-gnu/libogg.so.0.7.1
7f0ed879a000-7f0ed879b000 rw-p 00006000 fc:00 27378 /usr/lib/x86_64-linux-gnu/libogg.so.0.7.1
7f0ed879b000-7f0ed87c6000 r-xp 00000000 fc:00 27385 /usr/lib/x86_64-linux-gnu/libvorbis.so.0.4.5
7f0ed87c6000-7f0ed89c5000 ---p 0002b000 fc:00 27385 /usr/lib/x86_64-linux-gnu/libvorbis.so.0.4.5
7f0ed89c5000-7f0ed89c6000 r--p 0002a000 fc:00 27385 /usr/lib/x86_64-linux-gnu/libvorbis.so.0.4.5
7f0ed89c6000-7f0ed89c7000 rw-p 0002b000 fc:00 27385 /usr/lib/x86_64-linux-gnu/libvorbis.so.0.4.5
7f0ed89c7000-7f0ed8c7a000 r-xp 00000000 fc:00 27387 /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2.0.8
7f0ed8c7a000-7f0ed8e79000 ---p 002b3000 fc:00 27387 /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2.0.8
7f0ed8e79000-7f0ed8e95000 r--p 002b2000 fc:00 27387 /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2.0.8
7f0ed8e95000-7f0ed8e96000 rw-p 002ce000 fc:00 27387 /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2.0.8
7f0ed8e96000-7f0ed8ede000 r-xp 00000000 fc:00 27380 /usr/lib/x86_64-linux-gnu/libFLAC.so.8.2.0
7f0ed8ede000-7f0ed90de000 ---p 00048000 fc:00 27380 /usr/lib/x86_64-linux-gnu/libFLAC.so.8.2.0
7f0ed90de000-7f0ed90df000 r--p 00048000 fc:00 27380 /usr/lib/x86_64-linux-gnu/libFLAC.so.8.2.0
7f0ed90df000-7f0ed90e0000 rw-p 00049000 fc:00 27380 /usr/lib/x86_64-linux-gnu/libFLAC.so.8.2.0
7f0ed90e0000-7f0ed9293000 r-xp 00000000 fc:00 969 /lib/x86_64-linux-gnu/libc-2.15.so
7f0ed9293000-7f0ed9492000 ---p 001b3000 fc:00 969 /lib/x86_64-linux-gnu/libc-2.15.so
7f0ed9492000-7f0ed9496000 r--p 001b2000 fc:00 969 /lib/x86_64-linux-gnu/libc-2.15.so
7f0ed9496000-7f0ed9498000 rw-p 001b6000 fc:00 969 /lib/x86_64-linux-gnu/libc-2.15.so
7f0ed9498000-7f0ed949d000 rw-p 00000000 00:00 0
7f0ed949d000-7f0ed9596000 r-xp 00000000 fc:00 968 /lib/x86_64-linux-gnu/libm-2.15.so
7f0ed9596000-7f0ed9795000 ---p 000f9000 fc:00 968 /lib/x86_64-linux-gnu/libm-2.15.so
7f0ed9795000-7f0ed9796000 r--p 000f8000 fc:00 968 /lib/x86_64-linux-gnu/libm-2.15.so
7f0ed9796000-7f0ed9797000 rw-p 000f9000 fc:00 968 /lib/x86_64-linux-gnu/libm-2.15.so
7f0ed9797000-7f0ed9850000 r-xp 00000000 fc:00 29824 /usr/lib/x86_64-linux-gnu/libcairo.so.2.11000.2
7f0ed9850000-7f0ed9a4f000 ---p 000b9000 fc:00 29824 /usr/lib/x86_64-linux-gnu/libcairo.so.2.11000.2
7f0ed9a4f000-7f0ed9a51000 r--p 000b8000 fc:00 29824 /usr/lib/x86_64-linux-gnu/libcairo.so.2.11000.2
7f0ed9a51000-7f0ed9a52000 rw-p 000ba000 fc:00 29824 /usr/lib/x86_64-linux-gnu/libcairo.so.2.11000.2
7f0ed9a52000-7f0ed9a55000 rw-p 00000000 00:00 0
7f0ed9a55000-7f0ed9ab5000 r-xp 00000000 fc:00 27389 /usr/lib/x86_64-linux-gnu/libsndfile.so.1.0.25
7f0ed9ab5000-7f0ed9cb5000 ---p 00060000 fc:00 27389 /usr/lib/x86_64-linux-gnu/libsndfile.so.1.0.25
7f0ed9cb5000-7f0ed9cb7000 r--p 00060000 fc:00 27389 /usr/lib/x86_64-linux-gnu/libsndfile.so.1.0.25
7f0ed9cb7000-7f0ed9cb8000 rw-p 00062000 fc:00 27389 /usr/lib/x86_64-linux-gnu/libsndfile.so.1.0.25
7f0ed9cb8000-7f0ed9cbc000 rw-p 00000000 00:00 0
7f0ed9cbc000-7f0ed9cde000 r-xp 00000000 fc:00 972 /lib/x86_64-linux-gnu/ld-2.15.so
7f0ed9ec8000-7f0ed9ed3000 rw-p 00000000 00:00 0
7f0ed9edb000-7f0ed9ede000 rw-p 00000000 00:00 0
7f0ed9ede000-7f0ed9edf000 r--p 00022000 fc:00 972 /lib/x86_64-linux-gnu/ld-2.15.so
7f0ed9edf000-7f0ed9ee1000 rw-p 00023000 fc:00 972 /lib/x86_64-linux-gnu/ld-2.15.so
7fffeed04000-7fffeed25000 rw-p 00000000 00:00 0 [stack]
7fffeedff000-7fffeee00000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Aborted (core dumped)

This has nothing to do with the size of the PNG file. The problem can also be reproduced with:

sndfile-waveform -B 0x00000000 -F 0xFF000000 -g 1601x150 6722ccba-f179-11e1-be45-0800270e481f.wav out.png

Fixed in commit 0b3cee6.

Thanks for the bug report.