diff options
author | Cédric Schieli <cschieli@gmail.com> | 2009-03-17 19:51:52 +0000 |
---|---|---|
committer | Cédric Schieli <cschieli@gmail.com> | 2009-03-17 19:51:52 +0000 |
commit | 4c01b868de80e94a5619370e02f8d45dde4007b7 (patch) | |
tree | ce616947d628e4b79614b3fad93ccaf055285b53 /libswscale/swscale.c | |
parent | 79ff11d78f260203588e9fbb0be9d22143337bc3 (diff) | |
download | ffmpeg-4c01b868de80e94a5619370e02f8d45dde4007b7.tar.gz |
Don't write outside of the picture buffer in planarCopy in the gray case
Originally committed as revision 28985 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
Diffstat (limited to 'libswscale/swscale.c')
-rw-r--r-- | libswscale/swscale.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libswscale/swscale.c b/libswscale/swscale.c index c6012c15b7..8728e2bb6c 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -1934,8 +1934,14 @@ static int planarCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli if ((isGray(c->srcFormat) || isGray(c->dstFormat)) && plane>0) { - if (!isGray(c->dstFormat)) - memset(dst[plane], 128, dstStride[plane]*height); + if (!isGray(c->dstFormat)){ + int i; + uint8_t *ptr = dst[plane] + dstStride[plane]*y; + for (i=0; i<height; i++){ + memset(ptr, 128, length); + ptr += dstStride[plane]; + } + } } else { |