changeset 6963:cc2c5a21a0eb libavcodec

memcpy considering output width, not src linesize, fix segv with av_picture_pad
author bcoudurier
date Sun, 01 Jun 2008 02:28:33 +0000
parents c4e281443310
children 3504fdd54fd3
files imgconvert.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/imgconvert.c	Sun Jun 01 02:21:53 2008 +0000
+++ b/imgconvert.c	Sun Jun 01 02:28:33 2008 +0000
@@ -2063,7 +2063,7 @@
             uint8_t *iptr = src->data[i];
             optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) +
                     (padleft >> x_shift);
-            memcpy(optr, iptr, src->linesize[i]);
+            memcpy(optr, iptr, (width - padleft - padright) >> x_shift);
             iptr += src->linesize[i];
             optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) +
                 (dst->linesize[i] - (padright >> x_shift));
@@ -2071,7 +2071,7 @@
             for (y = 0; y < yheight; y++) {
                 memset(optr, color[i], (padleft + padright) >> x_shift);
                 memcpy(optr + ((padleft + padright) >> x_shift), iptr,
-                    src->linesize[i]);
+                       (width - padleft - padright) >> x_shift);
                 iptr += src->linesize[i];
                 optr += dst->linesize[i];
             }