[FFmpeg-cvslog] extend log line buffer sizes

Wolfram Gloger git at videolan.org
Fri Jun 22 19:18:51 CEST 2012


ffmpeg | branch: master | Wolfram Gloger <wmglo at dent.med.uni-muenchen.de> | Fri Jun 22 18:15:09 2012 +0200| [258dfff8394d383beaa639d19912b3f068f67e16] | committer: Michael Niedermayer

extend log line buffer sizes

The string passed to av_vlog() from libx264's X264_log overflows the 512
byte part_size, truncating x264 parameter output.  Double this size
and put it in a #define so it only needs to be changed in one place.

Signed-off-by: Wolfram Gloger <video06 at malloc.de>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavutil/log.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavutil/log.c b/libavutil/log.c
index c9c0922..f2272fb 100644
--- a/libavutil/log.c
+++ b/libavutil/log.c
@@ -29,6 +29,8 @@
 #include "avutil.h"
 #include "log.h"
 
+#define LINE_SZ 1024
+
 static int av_log_level = AV_LOG_INFO;
 static int flags;
 
@@ -148,7 +150,7 @@ static int get_category(void *ptr){
 }
 
 static void format_line(void *ptr, int level, const char *fmt, va_list vl,
-                        char part[3][512], int part_size, int *print_prefix, int type[2])
+                        char part[3][LINE_SZ], int part_size, int *print_prefix, int type[2])
 {
     AVClass* avc = ptr ? *(AVClass **) ptr : NULL;
     part[0][0] = part[1][0] = part[2][0] = 0;
@@ -176,7 +178,7 @@ static void format_line(void *ptr, int level, const char *fmt, va_list vl,
 void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl,
                         char *line, int line_size, int *print_prefix)
 {
-    char part[3][512];
+    char part[3][LINE_SZ];
     format_line(ptr, level, fmt, vl, part, sizeof(part[0]), print_prefix, NULL);
     snprintf(line, line_size, "%s%s%s", part[0], part[1], part[2]);
 }
@@ -185,9 +187,9 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
 {
     static int print_prefix = 1;
     static int count;
-    static char prev[1024];
-    char part[3][512];
-    char line[1024];
+    static char prev[LINE_SZ];
+    char part[3][LINE_SZ];
+    char line[LINE_SZ];
     static int is_atty;
     int type[2];
 



More information about the ffmpeg-cvslog mailing list