Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwm4 <nfxjfg@googlemail.com>2015-01-13 16:47:47 +0300
committerMichael Niedermayer <michaelni@gmx.at>2015-01-13 19:27:45 +0300
commit921706691a87c3ea5f5b92afd9b423e5f8c6e9d9 (patch)
treee02ce2c68d119c6400c9ed15916089a67e5767bd /libavcodec/qpeg.c
parent295b79b5d8c0cf0a9691f8d6b512aa1e289d528d (diff)
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>
Diffstat (limited to 'libavcodec/qpeg.c')
-rw-r--r--libavcodec/qpeg.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libavcodec/qpeg.c b/libavcodec/qpeg.c
index d61bceafd7..71f322b828 100644
--- a/libavcodec/qpeg.c
+++ b/libavcodec/qpeg.c
@@ -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--;