summaryrefslogtreecommitdiff
path: root/libavcodec/qpeg.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/qpeg.c')
-rw-r--r--libavcodec/qpeg.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/qpeg.c b/libavcodec/qpeg.c
index cb452621e7..654fd998d6 100644
--- a/libavcodec/qpeg.c
+++ b/libavcodec/qpeg.c
@@ -80,7 +80,10 @@ static void qpeg_decode_intra(QpegContext *qctx, uint8_t *dst,
p = bytestream2_get_byte(&qctx->buffer);
for(i = 0; i < run; i++) {
- dst[filled++] = p;
+ int step = FFMIN(run - i, width - filled);
+ memset(dst+filled, p, step);
+ filled += step;
+ i += step - 1;
if (filled >= width) {
filled = 0;
dst -= stride;