[FFmpeg-devel] [PATCH] Handle initial RTMP chunk size packet

Nicolas George george at nsup.org
Sun Apr 13 12:04:14 CEST 2014


Le quartidi 24 germinal, an CCXXII, Stephan Soller a écrit :
> >From ff1c93e55fff3e162e2599c1f61ca683f504439f Mon Sep 17 00:00:00 2001
> From: Stephan Soller <stephan.soller at helionweb.de>
> Date: Sun, 13 Apr 2014 01:06:22 +0200
> Subject: [PATCH] avformat/rtmpproto: Added handling of an initial RTMP chunk
>  size packet.
> 
> Fixes ticket #2911.
> ---
>  libavformat/rtmpproto.c |   11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
> index 9a80c2f..9c62164 100644
> --- a/libavformat/rtmpproto.c
> +++ b/libavformat/rtmpproto.c
> @@ -408,6 +408,17 @@ static int read_connect(URLContext *s, RTMPContext *rt)
>      if ((ret = ff_rtmp_packet_read(rt->stream, &pkt, rt->in_chunk_size,
>                                     &rt->prev_pkt[0], &rt->nb_prev_pkt[0])) < 0)
>          return ret;
> +    
> +    if (pkt.type == RTMP_PT_CHUNK_SIZE) {
> +        cp = pkt.data;

> +        rt->in_chunk_size = bytestream_get_be32(&cp);

Should you not validate this value? The handle_chunk_size() function does at
least a check for negative values.

> +        
> +        ff_rtmp_packet_destroy(&pkt);
> +        if ((ret = ff_rtmp_packet_read(rt->stream, &pkt, rt->in_chunk_size,
> +                                       &rt->prev_pkt[0], &rt->nb_prev_pkt[0])) < 0)
> +            return ret;
> +    }
> +    
>      cp = pkt.data;
>      bytestream2_init(&gbc, cp, pkt.size);
>      if (ff_amf_read_string(&gbc, command, sizeof(command), &stringlen)) {

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140413/23cdb5d2/attachment.asc>


More information about the ffmpeg-devel mailing list