[FFmpeg-devel] [PATCH] HTTP options in HLS (again)

Stefano Sabatini stefasab at gmail.com
Tue Jan 22 22:01:30 CET 2013


On date Friday 2013-01-18 21:24:44 -0500, Micah Galizia encoded:
> On Fri, Jan 18, 2013 at 2:14 PM, Stefano Sabatini <stefasab at gmail.com>wrote:
[...]
> From 8e6abcbe032d5dbd9aab8163919319f1f6136639 Mon Sep 17 00:00:00 2001
> From: Micah Galizia <micahgalizia at gmail.com>
> Date: Fri, 18 Jan 2013 21:20:58 -0500
> Subject: [PATCH] broker important HTTP protocol options. Fixes ticket #1291
> 
> ---
>  libavformat/hls.c |   32 ++++++++++++++++++++++++++++++--
>  1 file changed, 30 insertions(+), 2 deletions(-)
[...]
> @@ -461,11 +475,25 @@ reload:
>  
>  static int hls_read_header(AVFormatContext *s)
>  {
> +    URLContext *u = s->pb->opaque;
>      HLSContext *c = s->priv_data;
>      int ret = 0, i, j, stream_offset = 0;
>  
>      c->interrupt_callback = &s->interrupt_callback;
>  
> +    // if the URL context is good, read important options we must broker later
> +    if (u) {
> +        // get the previous user agent & set back to null if string size is zero

> +        av_opt_get(u->priv_data, "user-agent", 0, (uint8_t**)&(c->user_agent));
> +        if (!strlen(c->user_agent))
> +            av_freep(&c->user_agent);
> +
> +        // get the previous cookies & set back to null if string size is zero
> +        av_opt_get(u->priv_data, "cookies", 0, (uint8_t**)&(c->cookies));
> +        if (!strlen(c->cookies))
> +            av_freep(&c->cookies);

Leak in case c->user_agent/cookies is already set.

I'll fix and push in a day if I read no more comments (but feel free
to send an updated patch).
-- 
FFmpeg = Fantastic and Fanciful Mystic Patchable EnGraver


More information about the ffmpeg-devel mailing list