[FFmpeg-devel] [PATCH] libavformat/dashdec: Fix issue with dash on Windows
Andreas Rheinhardt
andreas.rheinhardt at gmail.com
Thu Oct 8 15:53:39 EEST 2020
Christopher Degawa:
> Use xmlFree instead of av_freep
>
> snip from libxml2:
>
> * xmlGetProp:
> ...
> * Returns the attribute value or NULL if not found.
> * It's up to the caller to free the memory with xmlFree().
>
> According to libxml2, you are supposed to use xmlFree instead of free
> on the pointer returned by it, and also using av_freep on Windows will
> call _aligned_free instead of normal free, causing _aligned_free to raise
> SIGTRAP and crashing ffmpeg and ffplay.
>
> To reproduce, download a build from gyan or BtBN for windows
> (also happens with some of Zeranoe's builds)
>
> https://www.gyan.dev/ffmpeg/builds/
> https://github.com/BtbN/FFmpeg-Builds
>
> and run either
>
> ffplay.exe http://download.tsi.telecom-paristech.fr/gpac/DASH_CONFORMANCE/TelecomParisTech/mp4-live/mp4-live-mpd-AV-NBS.mpd
>
> or
>
> ffmpeg.exe -i http://download.tsi.telecom-paristech.fr/gpac/DASH_CONFORMANCE/TelecomParisTech/mp4-live/mp4-live-mpd-AV-NBS.mpd -f null -
>
> Signed-off-by: Christopher Degawa <ccom at randomderp.com>
> ---
> libavformat/dashdec.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 99b9c45439..42ea74635b 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -1145,7 +1145,7 @@ static int parse_manifest_adaptationset(AVFormatContext *s, const char *url,
> }
>
> err:
> - av_freep(&c->adaptionset_lang);
> + xmlFree(c->adaptionset_lang);
> return ret;
> }
>
>
You should also reset c->adaptionset_lang to NULL after freeing it. (I
remember finding this issue myself, but somehow forgot to fix it. Strange.)
(Actually, the lifetime of adaptionset_lang does not extend beyond
parse_manifest_adaptationset(), so one could even use a local variable
for it.)
- Andreas
More information about the ffmpeg-devel
mailing list