[rtmpdump] add packet size check in ServeInvoke() for rtmpsuck

Jonathan Valliere sybersnake at gmail.com
Mon Jan 11 23:17:59 CET 2016


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. 

Sent from my iPhone

> On Jan 11, 2016, at 12:20 PM, fcicq <fcicq at fcicq.net> wrote:
> 
> Without the nBodySize check, the later (body[0] != 0x02) check will trigger a null pointer deference and cause a crash.
> This kind of empty packet may have some relationship with NetStream.Video.DimensionChange event.
> 
> diff --git a/rtmpsuck.c b/rtmpsuck.c
> index e886179..633a1f3 100644
> --- a/rtmpsuck.c
> +++ b/rtmpsuck.c
> @@ -160,6 +160,12 @@ ServeInvoke(STREAMING_SERVER *server, int which, RTMPPacket *pack, const char *b
>   int ret = 0, nRes;
>   int nBodySize = pack->m_nBodySize;
> 
> +  if (!nBodySize)
> +    {
> +      RTMP_Log(RTMP_LOGERROR, "%s, empty packet from %s", __FUNCTION__, cst[which]);
> +      return 0;
> +    }
> +
>   if (body > pack->m_body)
>     nBodySize--;
> 
> 
> _______________________________________________
> rtmpdump mailing list
> rtmpdump at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/rtmpdump


More information about the rtmpdump mailing list