[FFmpeg-cvslog] matroskadec: check av_strdup() when setting defaults
Anton Khirnov
git at videolan.org
Wed Sep 25 09:58:25 CEST 2013
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed Sep 4 08:55:17 2013 +0200| [668643b9239c70b777aea322eab411ebc960d9a0] | committer: Anton Khirnov
matroskadec: check av_strdup() when setting defaults
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=668643b9239c70b777aea322eab411ebc960d9a0
---
libavformat/matroskadec.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index dc32fd1..e6c9adf 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;
}
More information about the ffmpeg-cvslog
mailing list