Commit 3ff6d40c authored by Hendrik Leppkes's avatar Hendrik Leppkes

Merge commit 'b4a82e74'

* commit 'b4a82e74':
  h264: Print the complete user message
Merged-by: 's avatarHendrik Leppkes <h.leppkes@gmail.com>
parents ed6d451d b4a82e74
...@@ -224,13 +224,17 @@ static int decode_registered_user_data(H264Context *h, int size) ...@@ -224,13 +224,17 @@ static int decode_registered_user_data(H264Context *h, int size)
static int decode_unregistered_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; int e, build, i;
if (size < 16) if (size < 16 || size >= INT_MAX - 16)
return AVERROR_INVALIDDATA; 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] = get_bits(&h->gb, 8);
user_data[i] = 0; user_data[i] = 0;
...@@ -243,9 +247,7 @@ static int decode_unregistered_user_data(H264Context *h, int size) ...@@ -243,9 +247,7 @@ static int decode_unregistered_user_data(H264Context *h, int size)
if (strlen(user_data + 16) > 0) if (strlen(user_data + 16) > 0)
av_log(h->avctx, AV_LOG_DEBUG, "user data:\"%s\"\n", user_data + 16); av_log(h->avctx, AV_LOG_DEBUG, "user data:\"%s\"\n", user_data + 16);
for (; i < size; i++) av_free(user_data);
skip_bits(&h->gb, 8);
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment