Browse Source

qpeg: avoid pointless invalid memcpy()

If refdata was NULL, the memcpy() ended up copying the same memory
block onto itself, which is not only pointless, but also undefined
behavior.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 921706691a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.4.7
wm4 Michael Niedermayer 11 years ago
parent
commit
d705125b94
1 changed files with 7 additions and 6 deletions
  1. +7
    -6
      libavcodec/qpeg.c

+ 7
- 6
libavcodec/qpeg.c View File

@@ -120,12 +120,13 @@ static void av_noinline qpeg_decode_inter(QpegContext *qctx, uint8_t *dst,
int filled = 0;
int orig_height;

if(!refdata)
refdata= dst;

/* copy prev frame */
for(i = 0; i < height; i++)
memcpy(dst + (i * stride), refdata + (i * stride), width);
if (refdata) {
/* copy prev frame */
for (i = 0; i < height; i++)
memcpy(dst + (i * stride), refdata + (i * stride), width);
} else {
refdata = dst;
}

orig_height = height;
height--;


Loading…
Cancel
Save