<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta content="text/html;charset=UTF-8" http-equiv="Content-Type"></head><body ><div>The caller of ServeInvoke() is ServePacket().<br></div><div><span class="s1"><br></span></div><div><span class="s1"><div>    case RTMP_PACKET_TYPE_FLEX_MESSAGE:</div><div>      // flex message</div><div>      {</div><div>        ret = ServeInvoke(server, which, packet, packet->m_body + 1);</div><div>        break;</div><div>      }</div><div>    case RTMP_PACKET_TYPE_INVOKE:</div><div>      // invoke</div><div>      ret = ServeInvoke(server, which, packet, packet->m_body);</div><div>      break;</div></span></div><div><span class="s1"><br></span><br></div><div>but sadly, if nBodySize is 0, packet->m_body or body in ServeInvoke() which will also become null, would you expect AMF_Decode() to output an usable command?</div><BR /><BR /><BR /><BR /><BR /><BR /><BR /><BR /><div><br></div><div>Maybe this empty packet should trigger a warning type log, but as long as the return value is 0, that is not so critical.</div><div><br></div><br><br><div id="signid"></div><div id="replyid"><br><br><blockquote style="margin:0 0 0 .8ex;border-left: 1px solid rgb(0, 0, 255); padding-left:1ex;">The Video.DimensionChange event is a courtesy event from the player and does not exist on the wire. Empty packets are valid part of the spec. They have a number of uses in RTMP. <br><br>Sent from my iPhone<br><br>> On Jan 11, 2016, at 12:20 PM, fcicq <<a href="mailto:fcicq@fcicq.net" target="_blank">fcicq@fcicq.net</a>> wrote:<br>> <br>> Without the nBodySize check, the later (body[0] != 0x02) check will trigger a null pointer deference and cause a crash.<br>> This kind of empty packet may have some relationship with NetStream.Video.DimensionChange event.<br>> <br>> diff --git a/rtmpsuck.c b/rtmpsuck.c<br>> index e886179..633a1f3 100644<br>> --- a/rtmpsuck.c<br>> +++ b/rtmpsuck.c<br>> @@ -160,6 +160,12 @@ ServeInvoke(STREAMING_SERVER *server, int which, RTMPPacket *pack, const char *b<br>>   int ret = 0, nRes;<br>>   int nBodySize = pack->m_nBodySize;<br>> <br>> +  if (!nBodySize)<br>> +    {<br>> +      RTMP_Log(RTMP_LOGERROR, "%s, empty packet from %s", __FUNCTION__, cst[which]);<br>> +      return 0;<br>> +    }<br>> +<br>>   if (body > pack->m_body)<br>>     nBodySize--;<br>> <br>> <br>> _______________________________________________<br>> rtmpdump mailing list<br>> <a href="mailto:rtmpdump@mplayerhq.hu" target="_blank">rtmpdump@mplayerhq.hu</a><br>> <a href="https://lists.mplayerhq.hu/mailman/listinfo/rtmpdump" target="_blank">https://lists.mplayerhq.hu/mailman/listinfo/rtmpdump</a><br>_______________________________________________<br>rtmpdump mailing list<br><a href="mailto:rtmpdump@mplayerhq.hu" target="_blank">rtmpdump@mplayerhq.hu</a><br><a href="https://lists.mplayerhq.hu/mailman/listinfo/rtmpdump" target="_blank">https://lists.mplayerhq.hu/mailman/listinfo/rtmpdump</a><br></blockquote></div></body></html>