<div dir="ltr"><div><div><div>Hey guys,</div><div><br></div><div>I've run into a case that happens while running rtmpsuck where a null dereference will eventually occur.  I'm running a Windows build currently but this was present in the Linux build also from the latest version on back.</div><div><br></div><div><br></div><div>FAULTING_IP: </div><div>image00400000+2eab</div><div>00402eab 8b0482          mov     eax,dword ptr [edx+eax*4]</div><div><br></div><div>EXCEPTION_RECORD:  ffffffff -- (.exr 0xffffffffffffffff)</div><div>ExceptionAddress: 00402eab (image00400000+0x00002eab)</div><div>   ExceptionCode: c0000005 (Access violation)</div><div>  ExceptionFlags: 00000000</div><div>NumberParameters: 2</div><div>   Parameter[0]: 00000000</div><div>   Parameter[1]: 00000018</div><div>Attempt to read from address 00000018</div><div><br></div><div>CONTEXT:  00000000 -- (.cxr 0x0;r)</div><div>eax=00000006 ebx=0b835be0 ecx=0dce1298 edx=00000000 esi=0e60fdb8 edi=0b835bf0</div><div>eip=00402eab esp=0e60fd3c ebp=0e60ff14 iopl=0         nv up ei pl zr na pe nc</div><div>cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00010246</div><div>image00400000+0x2eab:</div><div>00402eab 8b0482          mov     eax,dword ptr [edx+eax*4] ds:002b:00000018=????????</div><div><br></div><div><br></div><div>rtmpsuck.c on line 818:</div><div><br></div><div>server->rc.m_pauseStamp = server->rc.m_channelTimestamp[server->rc.m_mediaChannel];</div><div><br></div><div>compiles to:</div><div><br></div><div>mov<span class="" style="white-space:pre">  </span>ecx, [ebx+8418h]</div><div>test<span class="" style="white-space:pre">       </span>ecx, ecx</div><div>jz<span class="" style="white-space:pre"> </span>short loc_402EE2<span class="" style="white-space:pre">  </span># jz server->f_cur</div><div>mov<span class="" style="white-space:pre">   </span>eax, [ebx+4224h]<span class="" style="white-space:pre">  </span># server->rc.m_mediaChannel => eax (6)</div><div>test<span class="" style="white-space:pre">   </span>eax, eax</div><div>jz<span class="" style="white-space:pre"> </span>short loc_402EE2<span class="" style="white-space:pre">  </span># jz server->rc.m_mediaChannel</div><div>mov<span class="" style="white-space:pre">       </span>edx, [ebp+var_1A4]</div><div>test<span class="" style="white-space:pre">     </span>edx, edx</div><div>jnz<span class="" style="white-space:pre">        </span>short loc_402EE2<span class="" style="white-space:pre">  </span># jnz paused</div><div>mov<span class="" style="white-space:pre">    </span>edx, [ebx+425Ch]<span class="" style="white-space:pre">  </span># server->rc.m_channelTimestamp => edx (0)</div><div>mov<span class="" style="white-space:pre">        </span>eax, [edx+eax*4]<span class="" style="white-space:pre">  </span># edx(0)+eax(6)*4 == 0x18</div><div>mov<span class="" style="white-space:pre">       </span>[ebx+422Ch], eax</div><div>mov<span class="" style="white-space:pre">        </span>eax, [ebp+var_19C]</div><div>mov<span class="" style="white-space:pre">      </span>[esp], eax</div><div>call<span class="" style="white-space:pre">     </span>_RTMP_ToggleStream</div><div>test<span class="" style="white-space:pre">     </span>eax, eax</div><div><br></div><div><br></div><div>The following patch seems to at least prevent the process from crashing but I was hoping to get some input in case this might just be a symptom of another problem.  I'm not familiar enough with the protocol or codebase.  Any thoughts?</div><div><br></div><div>rtmpsuck.c:</div><div><br></div><div>818c818</div><div><               if (server->f_cur && server->rc.m_mediaChannel && server->rc.m_channelTimestamp && !paused)</div><div>---</div><div>>               if (server->f_cur && server->rc.m_mediaChannel && !paused)</div></div></div><div><br></div><div><br></div><div>Regards,</div><div>Matt Breedlove</div></div>