diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2009-12-13 20:27:29 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2009-12-13 20:27:29 +0000 |
commit | 12ad66712a18d039eea73a742ae626b2376f8f4f (patch) | |
tree | f6d863c1a428480ad0366d48c44c8b89ef53b3e3 /libavformat/soxdec.c | |
parent | b8f11ec8878641f699c07b8425079d3611a51072 (diff) | |
download | ffmpeg-12ad66712a18d039eea73a742ae626b2376f8f4f.tar.gz |
Use AV_METADATA_DONT_STRDUP* / use av_malloced metadata instead of strduped
arrays of fixed length.
Code from ffmbc with changes to adapt to our metadata API.
Originally committed as revision 20836 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/soxdec.c')
-rw-r--r-- | libavformat/soxdec.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libavformat/soxdec.c b/libavformat/soxdec.c index 59c0278ce2..ceaedec293 100644 --- a/libavformat/soxdec.c +++ b/libavformat/soxdec.c @@ -93,15 +93,16 @@ static int sox_read_header(AVFormatContext *s, return -1; } - if (comment_size && - comment_size + FF_INPUT_BUFFER_PADDING_SIZE >= comment_size) { - char *comment = av_mallocz(comment_size + FF_INPUT_BUFFER_PADDING_SIZE); + if (comment_size && comment_size < UINT_MAX) { + char *comment = av_malloc(comment_size+1); if (get_buffer(pb, comment, comment_size) != comment_size) { av_freep(&comment); return AVERROR_IO; } - av_metadata_set(&s->metadata, "comment", comment); - av_freep(&comment); + comment[comment_size] = 0; + + av_metadata_set2(&s->metadata, "comment", comment, + AV_METADATA_DONT_STRDUP_VAL); } url_fskip(pb, header_size - SOX_FIXED_HDR - comment_size); |