[SCM] ffmpeg/master-0.6: add patch from upstream "Fix races in default av_log handler"

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sat Apr 30 08:25:07 UTC 2011


The following commit has been merged in the master-0.6 branch:
commit bb8af9132ddfc66c5f096bd0cf8fad06c601bb71
Author: Reinhard Tartler <siretart at tauware.de>
Date:   Sat Apr 30 10:23:54 2011 +0200

    add patch from upstream "Fix races in default av_log handler"
    
    might be exploitable

diff --git a/debian/patches/av_log_races.patch b/debian/patches/av_log_races.patch
new file mode 100644
index 0000000..0e88d3a
--- /dev/null
+++ b/debian/patches/av_log_races.patch
@@ -0,0 +1,48 @@
+From 66ebf37c735158e060c5acf8df62391b8b6182ef Mon Sep 17 00:00:00 2001
+From: Reinhard Tartler <siretart at sandy.tauware.de>
+Date: Sat, 30 Apr 2011 08:11:13 +0200
+Subject: [PATCH] Fix races in default av_log handler
+
+Prevent competing threads from overwriting (shared) buffers.
+
+Original patch by: Michael Niedermayer <michaelni at gmx.at>
+(cherry picked from commit 0247bdee2581a6857a24c5ff297f01d3a3112b11)
+---
+ libavutil/log.c |    7 ++++---
+ 1 files changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/libavutil/log.c b/libavutil/log.c
+index 9a8b66e..9319dcd 100644
+--- a/libavutil/log.c
++++ b/libavutil/log.c
+@@ -59,7 +59,8 @@ 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 line[1024], prev[1024];
++    static char prev[1024];
++    char line[1024];
+     static const uint8_t color[]={0x41,0x41,0x11,0x03,9,9,9};
+     AVClass* avc= ptr ? *(AVClass**)ptr : NULL;
+     if(level>av_log_level)
+@@ -73,7 +74,7 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
+     vsnprintf(line + strlen(line), sizeof(line) - strlen(line), fmt, vl);
+ 
+     print_prefix= line[strlen(line)-1] == '\n';
+-    if(print_prefix && !strcmp(line, prev)){
++    if(print_prefix && !strncmp(line, prev, sizeof line)){
+         count++;
+         return;
+     }
+@@ -82,7 +83,7 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
+         count=0;
+     }
+     colored_fputs(color[av_clip(level>>3, 0, 6)], line);
+-    strcpy(prev, line);
++    strncpy(prev, line, sizeof line);
+ }
+ 
+ static void (*av_log_callback)(void*, int, const char*, va_list) = av_log_default_callback;
+-- 
+1.6.1
+
diff --git a/debian/patches/series b/debian/patches/series
index 7bf33b6..bf11a72 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@
 disable-configuration-warning.patch
 AMV-fix-possibly-exploitable-crash.patch
 lavf-inspect-more-frames-for-fps-when-container-time-base-is-coarse.patch
+av_log_races.patch

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list