ffmpeg-php (0.6.0-2.2) gdtoimage_fix.patch

Summary

 ffmpeg_frame.c |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

    
download this patch

Patch contents

--- a/ffmpeg_frame.c
+++ b/ffmpeg_frame.c
@@ -284,15 +284,14 @@ static int _php_avframe_to_gd_image(AVFr
     int x, y;
     int *src = (int*)frame->data[0];
 
+	if(width > dest->sx || height > dest->sy){
+		return -1;
+	}
+
     for (y = 0; y < height; y++) {
         for (x = 0; x < width; x++) {
-		
-			if (gdImageBoundsSafeMacro(dest, x, y)) {
-                /* copy pixel to gdimage buffer zeroing the alpha channel */
-                dest->tpixels[y][x] = src[x] & 0x00ffffff;
-            } else {
-                return -1;
-            }
+            /* copy pixel to gdimage buffer zeroing the alpha channel */
+			dest->tpixels[y][x] = src[x] & 0x00ffffff;
         }
         src += width;
     }