diff -Naur ffmpeg-php-0.5.3.1.orig/ffmpeg_frame.c ffmpeg-php-0.5.3.1/ffmpeg_frame.c --- ffmpeg-php-0.5.3.1.orig/ffmpeg_frame.c 2008-08-22 17:03:55.000000000 +0200 +++ ffmpeg-php-0.5.3.1/ffmpeg_frame.c 2008-08-22 17:06:15.000000000 +0200 @@ -396,15 +396,14 @@ 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; }