comparison libswscale/swscale.c @ 31690:f2d98fc0702c

Do planar copy with a single memcpy only if the stride is equal to the length This avoids writing outside of the designated rectangle.
author mstorsjo
date Mon, 19 Jul 2010 07:02:31 +0000
parents eea755ce8eab
children d53473c681ac
comparison
equal deleted inserted replaced
31689:c447fb125915 31690:f2d98fc0702c
1661 for (j=0; j<length; j++) 1661 for (j=0; j<length; j++)
1662 ((uint16_t*)dstPtr)[j] = av_bswap16(((const uint16_t*)srcPtr)[j]); 1662 ((uint16_t*)dstPtr)[j] = av_bswap16(((const uint16_t*)srcPtr)[j]);
1663 srcPtr+= srcStride[plane]; 1663 srcPtr+= srcStride[plane];
1664 dstPtr+= dstStride[plane]; 1664 dstPtr+= dstStride[plane];
1665 } 1665 }
1666 } else if (dstStride[plane]==srcStride[plane] && srcStride[plane] > 0) { 1666 } else if (dstStride[plane]==srcStride[plane] && srcStride[plane] > 0 &&
1667 if (height > 0) 1667 srcStride[plane] == length) {
1668 memcpy(dst[plane] + dstStride[plane]*y, src[plane], 1668 memcpy(dst[plane] + dstStride[plane]*y, src[plane],
1669 (height - 1)*dstStride[plane] + length); 1669 height*dstStride[plane]);
1670 } else { 1670 } else {
1671 if(is16BPS(c->srcFormat) && is16BPS(c->dstFormat)) 1671 if(is16BPS(c->srcFormat) && is16BPS(c->dstFormat))
1672 length*=2; 1672 length*=2;
1673 for (i=0; i<height; i++) { 1673 for (i=0; i<height; i++) {
1674 memcpy(dstPtr, srcPtr, length); 1674 memcpy(dstPtr, srcPtr, length);