[FFmpeg-cvslog] Fix undefined behavior in ffv1 with insane widths.

Michael Niedermayer git at videolan.org
Fri Apr 1 13:45:09 CEST 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Apr  1 12:46:36 2011 +0200| [676d380f2adda2fdd5170e89b95bb9a112c3d18f] | committer: Michael Niedermayer

Fix undefined behavior in ffv1 with insane widths.
The new tables is large enough to prevent this together with our image size checks.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/bitstream.c |    6 ++++--
 libavcodec/ffv1.c      |    2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index 83f30f9..8fd44e3 100644
--- a/libavcodec/bitstream.c
+++ b/libavcodec/bitstream.c
@@ -32,11 +32,13 @@
 #include "get_bits.h"
 #include "put_bits.h"
 
-const uint8_t ff_log2_run[32]={
+const uint8_t ff_log2_run[41]={
  0, 0, 0, 0, 1, 1, 1, 1,
  2, 2, 2, 2, 3, 3, 3, 3,
  4, 4, 5, 5, 6, 6, 7, 7,
- 8, 9,10,11,12,13,14,15
+ 8, 9,10,11,12,13,14,15,
+16,17,18,19,20,21,22,23,
+24,
 };
 
 void align_put_bits(PutBitContext *s)
diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
index 7d1492f..b00b463 100644
--- a/libavcodec/ffv1.c
+++ b/libavcodec/ffv1.c
@@ -40,7 +40,7 @@
 #define MAX_QUANT_TABLES 8
 #define MAX_CONTEXT_INPUTS 5
 
-extern const uint8_t ff_log2_run[32];
+extern const uint8_t ff_log2_run[41];
 
 static const int8_t quant3[256]={
  0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,



More information about the ffmpeg-cvslog mailing list