diff options
author | Jindřich Makovička <makovick@gmail.com> | 2005-04-24 07:50:18 +0000 |
---|---|---|
committer | Jindřich Makovička <makovick@gmail.com> | 2005-04-24 07:50:18 +0000 |
commit | 12e1166234461fd1fafb4410ff69c000d2d1ec9a (patch) | |
tree | da47416b2131dc29fece7169e2dc42ae52f385e8 | |
parent | e63ac25d05587df64f615e548543fc5f0e8c33b9 (diff) | |
download | ffmpeg-12e1166234461fd1fafb4410ff69c000d2d1ec9a.tar.gz |
check for negative strides before memcpy
Originally committed as revision 15250 to svn://svn.mplayerhq.hu/mplayer/trunk/postproc
-rw-r--r-- | postproc/swscale.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/postproc/swscale.c b/postproc/swscale.c index a94de52af6..0c75f0a7a8 100644 --- a/postproc/swscale.c +++ b/postproc/swscale.c @@ -1425,7 +1425,7 @@ static int PlanarToNV12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], i int srcSliceH, uint8_t* dstParam[], int dstStride[]){ uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY; /* Copy Y plane */ - if(dstStride[0]==srcStride[0]) + if(dstStride[0]==srcStride[0] && srcStride[0] > 0) memcpy(dst, src[0], srcSliceH*dstStride[0]); else { @@ -1559,7 +1559,7 @@ static int yvu9toyv12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int int i; /* copy Y */ - if(srcStride[0]==dstStride[0]) + if(srcStride[0]==dstStride[0] && srcStride[0] > 0) memcpy(dst[0]+ srcSliceY*dstStride[0], src[0], srcStride[0]*srcSliceH); else{ uint8_t *srcPtr= src[0]; @@ -1633,7 +1633,7 @@ static int simpleCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli if(isPacked(c->srcFormat)) { - if(dstStride[0]==srcStride[0]) + if(dstStride[0]==srcStride[0] && srcStride[0] > 0) memcpy(dst[0] + dstStride[0]*srcSliceY, src[0], srcSliceH*dstStride[0]); else { @@ -1671,7 +1671,7 @@ static int simpleCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli } else { - if(dstStride[plane]==srcStride[plane]) + if(dstStride[plane]==srcStride[plane] && srcStride[plane] > 0) memcpy(dst[plane] + dstStride[plane]*y, src[plane], height*dstStride[plane]); else { |