diff options
author | Anton Khirnov <anton@khirnov.net> | 2013-09-04 08:55:17 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2013-09-24 17:11:50 +0200 |
commit | 668643b9239c70b777aea322eab411ebc960d9a0 (patch) | |
tree | e2a43791b1298605b065782f649091bd24376b5b | |
parent | 58894ab3f94d29b7497778289a21a166b6441a6a (diff) | |
download | ffmpeg-668643b9239c70b777aea322eab411ebc960d9a0.tar.gz |
matroskadec: check av_strdup() when setting defaults
-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 dc32fd1cc1..e6c9adf547 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -851,7 +851,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; } |