diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-09-25 09:38:33 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-09-25 09:39:24 +0200 |
commit | 57070d9892adf55b9fa475f377352b2d42e095a6 (patch) | |
tree | 21b5d6751ea0b95165de65d09e2815ab776bbccd | |
parent | 65bf9a44d7b0295e03463fd143499ab5b85d0cb7 (diff) | |
parent | 668643b9239c70b777aea322eab411ebc960d9a0 (diff) | |
download | ffmpeg-57070d9892adf55b9fa475f377352b2d42e095a6.tar.gz |
Merge commit '668643b9239c70b777aea322eab411ebc960d9a0'
* commit '668643b9239c70b777aea322eab411ebc960d9a0':
matroskadec: check av_strdup() when setting defaults
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/matroskadec.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index a1b7f56634..292bd29583 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -920,7 +920,13 @@ static int ebml_parse_nest(MatroskaDemuxContext *matroska, EbmlSyntax *syntax, break; case EBML_STR: case EBML_UTF8: - *(char **)((char *)data+syntax[i].data_offset) = av_strdup(syntax[i].def.s); + // the default may be NULL + if (syntax[i].def.s) { + uint8_t **dst = (uint8_t**)((uint8_t*)data + syntax[i].data_offset); + *dst = av_strdup(syntax[i].def.s); + if (!*dst) + return AVERROR(ENOMEM); + } break; } |