Mercurial > libavformat.hg
diff soxdec.c @ 5446:4211f91f69b1 libavformat
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.
author | michael |
---|---|
date | Sun, 13 Dec 2009 20:27:29 +0000 |
parents | bbdbcaf1e6f2 |
children | 134741dc8327 |
line wrap: on
line diff
--- a/soxdec.c Sun Dec 13 20:22:27 2009 +0000 +++ b/soxdec.c Sun Dec 13 20:27:29 2009 +0000 @@ -93,15 +93,16 @@ 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);