[FFmpeg-cvslog] h264: Print the complete user message

Vittorio Giovara git at videolan.org
Mon Nov 2 11:55:49 CET 2015


ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Thu Oct 22 14:13:29 2015 +0200| [b4a82e740743744136e07054525560351e4892ae] | committer: Vittorio Giovara

h264: Print the complete user message

Previously the message was cut off at 256th byte.
This will allow dumping the complete x264 encode info when needed.

Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b4a82e740743744136e07054525560351e4892ae
---

 libavcodec/h264_sei.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 2b25840..1fb1fc5 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -215,13 +215,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;
@@ -232,9 +236,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;
 }
 



More information about the ffmpeg-cvslog mailing list