[Ffmpeg-devel] [PATCH] imgresample off by one bug

Alex Beregszaszi alex
Sun Oct 29 23:01:54 CET 2006


Hi,

This small bug has been found by Steven Johnson in imgresample.c in
function sws_scale:

--- one/libavcodec/imgresample.c	2006-10-17 07:51:18.000000000 +1100
+++ two/libavcodec/imgresample.c	2006-10-19 22:39:34.000000000 +1100
@@ -686,7 +686,7 @@
     uint8_t *buf1 = NULL, *buf2 = NULL;
     enum PixelFormat current_pix_fmt;
 
-    for (i = 0; i < 3; i++) {
+    for (i = 0; i <= 3; i++) {
         src_pict.data[i] = src[i];
         src_pict.linesize[i] = srcStride[i];
         dst_pict.data[i] = dst[i];

AVPicture as defined in avcodec.h has 4 planes, but only 3 planes are
copied. Steve uses the 4th plane for some internal code, which possibly
wont be ever accepted for commiting into FFmpeg.

I know that Michael wants to remove all the old imgresample code, but
actually this belongs to swscaler.

-- 
Alex Beregszaszi | alex at fsn.hu




More information about the ffmpeg-devel mailing list