diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2008-06-01 06:28:33 +0400 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2008-06-01 06:28:33 +0400 |
commit | 1be97a218ee265e51b2085db3a7f565311470210 (patch) | |
tree | 8a73ff404aa66c96452c9ed2f1d81d5d3d735666 /libavcodec/imgconvert.c | |
parent | 64e3e66175563de33bbde5b2c0d3c3d97a729431 (diff) |
memcpy considering output width, not src linesize, fix segv with av_picture_pad
Originally committed as revision 13594 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/imgconvert.c')
-rw-r--r-- | libavcodec/imgconvert.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index 663095435e..6ef00c9100 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -2063,7 +2063,7 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, 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 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, 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]; } |