summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <[email protected]>2015-05-11 15:23:51 +0200
committerMichael Niedermayer <[email protected]>2015-06-17 21:50:06 +0200
commitd27b9d3bd1d216ec98807a8d7f1e04aab3975d8c (patch)
tree240125041484579c69e2769fd969ca4d7d85aff1
parent0b6c8bb26c623ec1f6484cb1071c67ad1f9662db (diff)
avformat/vorbiscomment: Check entry length in ff_vorbiscomment_write()
Signed-off-by: Michael Niedermayer <[email protected]> (cherry picked from commit eca38864a6ce5053e463b8d3fc22b22bc9a49578) Signed-off-by: Michael Niedermayer <[email protected]>
-rw-r--r--libavformat/vorbiscomment.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/vorbiscomment.c b/libavformat/vorbiscomment.c
index f17a0c1d13..7ca919cbf9 100644
--- a/libavformat/vorbiscomment.c
+++ b/libavformat/vorbiscomment.c
@@ -63,8 +63,10 @@ int ff_vorbiscomment_write(uint8_t **p, AVDictionary **m,
AVDictionaryEntry *tag = NULL;
bytestream_put_le32(p, count);
while ((tag = av_dict_get(*m, "", tag, AV_DICT_IGNORE_SUFFIX))) {
- unsigned int len1 = strlen(tag->key);
- unsigned int len2 = strlen(tag->value);
+ int64_t len1 = strlen(tag->key);
+ int64_t len2 = strlen(tag->value);
+ if (len1+1+len2 > UINT32_MAX)
+ return AVERROR(EINVAL);
bytestream_put_le32(p, len1+1+len2);
bytestream_put_buffer(p, tag->key, len1);
bytestream_put_byte(p, '=');