aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2015-11-02 11:54:34 +0100
committerHendrik Leppkes <h.leppkes@gmail.com>2015-11-02 11:54:34 +0100
commit3ff6d40cbcab3e6932617bc209f67d1b4530de7f (patch)
treecc3a237dd15d56fc292da4cce43f6b7cdf51ccc9
parented6d451d934cc5a285033e0d3d782df1841c0b34 (diff)
parentb4a82e740743744136e07054525560351e4892ae (diff)
downloadffmpeg-3ff6d40cbcab3e6932617bc209f67d1b4530de7f.tar.gz
Merge commit 'b4a82e740743744136e07054525560351e4892ae'
* commit 'b4a82e740743744136e07054525560351e4892ae': h264: Print the complete user message Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
-rw-r--r--libavcodec/h264_sei.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 194a98c81c..0411b87693 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -224,13 +224,17 @@ static int decode_registered_user_data(H264Context *h, int size)
static int decode_unregistered_user_data(H264Context *h, int size)
{
- uint8_t user_data[16 + 256];
+ uint8_t *user_data;
int e, build, i;
- if (size < 16)
+ if (size < 16 || size >= INT_MAX - 16)
return AVERROR_INVALIDDATA;
- for (i = 0; i < sizeof(user_data) - 1 && i < size; i++)
+ user_data = av_malloc(16 + size + 1);
+ if (!user_data)
+ return AVERROR(ENOMEM);
+
+ for (i = 0; i < size + 16; i++)
user_data[i] = get_bits(&h->gb, 8);
user_data[i] = 0;
@@ -243,9 +247,7 @@ static int decode_unregistered_user_data(H264Context *h, int size)
if (strlen(user_data + 16) > 0)
av_log(h->avctx, AV_LOG_DEBUG, "user data:\"%s\"\n", user_data + 16);
- for (; i < size; i++)
- skip_bits(&h->gb, 8);
-
+ av_free(user_data);
return 0;
}