aboutsummaryrefslogtreecommitdiff
path: root/libswscale/swscale.c
diff options
context:
space:
mode:
authorMartin Storsjö2010-07-19 07:02:31 +0000
committerMartin Storsjö2010-07-19 07:02:31 +0000
commit72ae5049e1c92d76b72263d98744b4dfbb002a2c (patch)
tree3faae1fdc09df8227c17d4578c578e06f6fbb2ca /libswscale/swscale.c
parent9f0e31d29a5f0c1a306ea3f0240edc7932158eaf (diff)
Do planar copy with a single memcpy only if the stride is equal to the length
This avoids writing outside of the designated rectangle. Originally committed as revision 31756 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
Diffstat (limited to 'libswscale/swscale.c')
-rw-r--r--libswscale/swscale.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index b589131375..0340e80bfe 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -1663,10 +1663,10 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t* src[], int srcStride[
srcPtr+= srcStride[plane];
dstPtr+= dstStride[plane];
}
- } else if (dstStride[plane]==srcStride[plane] && srcStride[plane] > 0) {
- if (height > 0)
+ } else if (dstStride[plane]==srcStride[plane] && srcStride[plane] > 0 &&
+ srcStride[plane] == length) {
memcpy(dst[plane] + dstStride[plane]*y, src[plane],
- (height - 1)*dstStride[plane] + length);
+ height*dstStride[plane]);
} else {
if(is16BPS(c->srcFormat) && is16BPS(c->dstFormat))
length*=2;