Commit c533d0fc authored by henry's avatar henry

check for negative strides before memcpy


git-svn-id: file:///var/local/repositories/mplayer/trunk/postproc@15250 b3059339-0415-0410-9bf9-f77b7e298cf2
parent 4d4e2387
...@@ -1425,7 +1425,7 @@ static int PlanarToNV12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], i ...@@ -1425,7 +1425,7 @@ static int PlanarToNV12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], i
int srcSliceH, uint8_t* dstParam[], int dstStride[]){ int srcSliceH, uint8_t* dstParam[], int dstStride[]){
uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY; uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
/* Copy Y plane */ /* Copy Y plane */
if(dstStride[0]==srcStride[0]) if(dstStride[0]==srcStride[0] && srcStride[0] > 0)
memcpy(dst, src[0], srcSliceH*dstStride[0]); memcpy(dst, src[0], srcSliceH*dstStride[0]);
else else
{ {
...@@ -1559,7 +1559,7 @@ static int yvu9toyv12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int ...@@ -1559,7 +1559,7 @@ static int yvu9toyv12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int
int i; int i;
/* copy Y */ /* 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); memcpy(dst[0]+ srcSliceY*dstStride[0], src[0], srcStride[0]*srcSliceH);
else{ else{
uint8_t *srcPtr= src[0]; uint8_t *srcPtr= src[0];
...@@ -1633,7 +1633,7 @@ static int simpleCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli ...@@ -1633,7 +1633,7 @@ static int simpleCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli
if(isPacked(c->srcFormat)) 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]); memcpy(dst[0] + dstStride[0]*srcSliceY, src[0], srcSliceH*dstStride[0]);
else else
{ {
...@@ -1671,7 +1671,7 @@ static int simpleCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli ...@@ -1671,7 +1671,7 @@ static int simpleCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli
} }
else 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]); memcpy(dst[plane] + dstStride[plane]*y, src[plane], height*dstStride[plane]);
else else
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment