<div dir="ltr"><div>Package: lame</div><div>Version: 3.99.5</div><div><br></div><div><div style="font-size:12.8000001907349px">This bug was found with american fuzzy lop (<a href="http://lcamtuf.coredump.cx/afl/" target="_blank">http://lcamtuf.coredump.cx/afl/</a>). I compiled lame as follows:</div><div style="font-size:12.8000001907349px">CC=/path/to/afl-gcc ./configure</div><div style="font-size:12.8000001907349px">AFL_HARDEN=1 make</div></div><div><br></div>GDB output:<br><div>Program received signal SIGSEGV, Segmentation fault.</div><div>[----------------------------------registers-----------------------------------]</div><div>RAX: 0xfffffffffffbe74d </div><div>RBX: 0xfffffff1 </div><div>RCX: 0x81f340 --> 0x3989e5fb00000000 </div><div>RDX: 0xfffbe74d </div><div>RSI: 0x6f6f34 ('4oo')</div><div>RDI: 0x714354 ('TCq')</div><div>RBP: 0x1f </div><div>RSP: 0x7fffffee5bd0 --> 0xb84b6c4c </div><div>RIP: 0x536cb8 (<fill_buffer+8064>:<span class="" style="white-space:pre">        </span>movss  xmm0,DWORD PTR [rdi])</div><div>R8 : 0x81a5a0 --> 0x0 </div><div>R9 : 0x80eb14 --> 0x0 </div><div>R10: 0xfffbe76c </div><div>R11: 0x20 (' ')</div><div>R12: 0xfffffffffffffff1 </div><div>R13: 0x1 </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>   0x536ca6 <fill_buffer+8046>:<span class="" style="white-space:pre"> </span>mov    rcx,QWORD PTR [rsp+0x8]</div><div>   0x536cab <fill_buffer+8051>:<span class="" style="white-space:pre">        </span>mov    rax,QWORD PTR [rsp+0x10]</div><div>   0x536cb0 <fill_buffer+8056>:<span class="" style="white-space:pre">       </span>lea    rsp,[rsp+0x98]</div><div>=> 0x536cb8 <fill_buffer+8064>:<span class="" style="white-space:pre">      </span>movss  xmm0,DWORD PTR [rdi]</div><div>   0x536cbc <fill_buffer+8068>:<span class="" style="white-space:pre">   </span>jmp    0x535494 <fill_buffer+1884></div><div>   0x536cc1 <fill_buffer+8073>:<span class="" style="white-space:pre">      </span>nop    DWORD PTR [rax+0x0]</div><div>   0x536cc8 <fill_buffer+8080>:<span class="" style="white-space:pre">    </span>lea    rsp,[rsp-0x98]</div><div>   0x536cd0 <fill_buffer+8088>:<span class="" style="white-space:pre"> </span>mov    QWORD PTR [rsp],rdx</div><div>[------------------------------------stack-------------------------------------]</div><div>0000| 0x7fffffee5bd0 --> 0xb84b6c4c </div><div>0008| 0x7fffffee5bd8 --> 0x0 </div><div>0016| 0x7fffffee5be0 --> 0x3fef584ef0d5840f </div><div>0024| 0x7fffffee5be8 --> 0x0 </div><div>0032| 0x7fffffee5bf0 --> 0x3fefd5f821e0e091 </div><div>0040| 0x7fffffee5bf8 --> 0x0 </div><div>0048| 0x7fffffee5c00 --> 0x2 </div><div>0056| 0x7fffffee5c08 --> 0x3f000000fffffff1 </div><div>[------------------------------------------------------------------------------]</div><div>Legend: code, data, rodata, value</div><div>Stopped reason: SIGSEGV</div><div>0x0000000000536cb8 in fill_buffer_resample (ch=<optimized out>, num_used=0x7fffffee5d30, len=0x1, inbuf=0x7fd200, desired_len=0x240, outbuf=0x80eb10, gfc=0x800cc0) at util.c:606</div><div>606<span class="" style="white-space:pre">        </span>            y = (j2 < 0) ? inbuf_old[BLACKSIZE + j2] : inbuf[j2];</div><div><br></div><div>Valgrind output:</div><div>==10757== <br></div><div><div>==10757== Process terminating with default action of signal 11 (SIGSEGV): dumping core</div><div>==10757==  Bad permissions for mapped region at address 0x59E9A94</div><div>==10757==    at 0x536CB8: fill_buffer (util.c:606)</div><div>==10757==    by 0x4802D4: lame_encode_buffer_sample_t (lame.c:1736)</div><div>==10757==    by 0x49A3C3: lame_encode_flush (lame.c:1902)</div><div>==10757==    by 0x4039AC: lame_encoder_loop (lame_main.c:487)</div><div>==10757==    by 0x406D92: lame_main (lame_main.c:531)</div><div>==10757==    by 0x402604: main (main.c:470)</div><div>LAME 3.99.5 64bits (<a href="http://lame.sf.net">http://lame.sf.net</a>)</div><div>Resampling:  input -2.14748e+06 kHz  output 8 kHz</div><div>Using polyphase lowpass filter, transition band:  3903 Hz -  4000 Hz</div><div>Encoding test09.wav to test09.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 style="font-size:12.8000001907349px">I've attached the test case which causes this crash.</div><div style="font-size:12.8000001907349px"><br>Debian 7, kernel v3.2.63-2+deb7u2 x86_64, libc6 v2.13-38+deb7u7</div></div></div>