<div dir="ltr">Package: lame<div>Version: 3.99.5</div><div><br></div><div><div>This bug was found with american fuzzy lop (<a href="http://lcamtuf.coredump.cx/afl/">http://lcamtuf.coredump.cx/afl/</a>). I compiled lame as follows:</div><div>CC=/path/to/afl-gcc ./configure</div><div>AFL_HARDEN=1 make<br><br>GDB output:</div></div><div><div>Program received signal SIGSEGV, Segmentation fault.</div><div>[----------------------------------registers-----------------------------------]</div><div>RAX: 0xffffffffffffffe1 </div><div>RBX: 0xfffffff1 </div><div>RCX: 0x0 </div><div>RDX: 0xffffffe1 </div><div>RSI: 0x7fd184 --> 0xf770be9800007fff </div><div>RDI: 0x81a5a4 --> 0x0 </div><div>RBP: 0x1f </div><div>RSP: 0x7fffffee5bd0 --> 0x0 </div><div>RIP: 0x5354d0 (<fill_buffer+1944>:<span class="" style="white-space:pre"> </span>mulss  xmm0,DWORD PTR [rcx])</div><div>R8 : 0x81a5a0 --> 0x0 </div><div>R9 : 0x80eb10 --> 0x0 </div><div>R10: 0x0 </div><div>R11: 0x20 (' ')</div><div>R12: 0xfffffffffffffff1 </div><div>R13: 0x0 </div><div>R14: 0x7 </div><div>R15: 0x800cc0 --> 0xfff88e3b</div><div>EFLAGS: 0x10286 (carry PARITY adjust zero SIGN trap INTERRUPT direction overflow)</div><div>[-------------------------------------code-------------------------------------]</div><div>   0x5354be <fill_buffer+1926>:<span class="" style="white-space:pre">        </span>mov    rcx,QWORD PTR [rsp+0x8]</div><div>   0x5354c3 <fill_buffer+1931>:<span class="" style="white-space:pre">        </span>mov    rax,QWORD PTR [rsp+0x10]</div><div>   0x5354c8 <fill_buffer+1936>:<span class="" style="white-space:pre">       </span>lea    rsp,[rsp+0x98]</div><div>=> 0x5354d0 <fill_buffer+1944>:<span class="" style="white-space:pre">      </span>mulss  xmm0,DWORD PTR [rcx]</div><div>   0x5354d4 <fill_buffer+1948>:<span class="" style="white-space:pre">   </span>add    edx,0x1</div><div>   0x5354d7 <fill_buffer+1951>:<span class="" style="white-space:pre">        </span>cmp    ebp,0x1</div><div>   0x5354da <fill_buffer+1954>:<span class="" style="white-space:pre">        </span>mov    eax,0x1</div><div>   0x5354df <fill_buffer+1959>:<span class="" style="white-space:pre">        </span>addss  xmm0,xmm6</div><div>[------------------------------------stack-------------------------------------]</div><div>0000| 0x7fffffee5bd0 --> 0x0 </div><div>0008| 0x7fffffee5bd8 --> 0x0 </div><div>0016| 0x7fffffee5be0 --> 0x0 </div><div>0024| 0x7fffffee5be8 --> 0x0 </div><div>0032| 0x7fffffee5bf0 --> 0x0 </div><div>0040| 0x7fffffee5bf8 --> 0x0 </div><div>0048| 0x7fffffee5c00 --> 0x0 </div><div>0056| 0x7fffffee5c08 --> 0x0 </div><div>[------------------------------------------------------------------------------]</div><div>Legend: code, data, rodata, value</div><div>Stopped reason: SIGSEGV</div><div>fill_buffer_resample (ch=<optimized out>, num_used=0x7fffffee5d30, len=0x1, inbuf=0x7fd200, desired_len=0x240, outbuf=0x80eb10, gfc=0x800cc0) at util.c:608</div><div>608<span class="" style="white-space:pre">    </span>            xvalue += y * esv->blackfilt[joff][i];</div></div><div><br></div><div>Valgrind output: </div><div><div>==53832== Invalid read of size 4</div><div>==53832==    at 0x5354D0: fill_buffer (util.c:608)</div><div>==53832==    by 0x4802D4: lame_encode_buffer_sample_t (lame.c:1736)</div><div>==53832==    by 0x49A3C3: lame_encode_flush (lame.c:1902)</div><div>==53832==    by 0x4039AC: lame_encoder_loop (lame_main.c:487)</div><div>==53832==    by 0x406D92: lame_main (lame_main.c:531)</div><div>==53832==    by 0x402604: main (main.c:470)</div><div>==53832==  Address 0x0 is not stack'd, malloc'd or (recently) free'd</div><div>==53832== </div><div>==53832== </div><div>==53832== Process terminating with default action of signal 11 (SIGSEGV): dumping core</div><div>==53832==  Access not within mapped region at address 0x0</div><div>==53832==    at 0x5354D0: fill_buffer (util.c:608)</div><div>==53832==    by 0x4802D4: lame_encode_buffer_sample_t (lame.c:1736)</div><div>==53832==    by 0x49A3C3: lame_encode_flush (lame.c:1902)</div><div>==53832==    by 0x4039AC: lame_encoder_loop (lame_main.c:487)</div><div>==53832==    by 0x406D92: lame_main (lame_main.c:531)</div><div>==53832==    by 0x402604: main (main.c:470)</div><div>==53832==  If you believe this happened as a result of a stack</div><div>==53832==  overflow in your program's main thread (unlikely but</div><div>==53832==  possible), you can try to increase the size of the</div><div>==53832==  main thread stack using the --main-stacksize= flag.</div><div>==53832==  The main thread stack size used in this run was 8388608.</div><div>LAME 3.99.5 64bits (<a href="http://lame.sf.net">http://lame.sf.net</a>)</div><div>Resampling:  input -352376 kHz  output 8 kHz</div><div>Using polyphase lowpass filter, transition band:  3903 Hz -  4000 Hz</div><div>Encoding test11.wav to test11.mp3</div><div>Encoding as 8 kHz j-stereo MPEG-2.5 Layer III (10.7x)  24 kbps qval=3</div><div>Only 8, 16, 24 and 32 bit input files supported </div><div>Segmentation fault</div></div><div><br></div><div><div>I've attached the test case which causes this crash.</div><div><br>Debian 7, kernel v3.2.63-2+deb7u2 x86_64, libc6 v2.13-38+deb7u7</div></div></div>