aboutsummaryrefslogtreecommitdiff
path: root/libavcodec/qdrw.c
diff options
context:
space:
mode:
authorCarl Eugen Hoyos2015-05-16 22:51:16 +0200
committerCarl Eugen Hoyos2015-05-17 02:08:58 +0200
commit1eda55510ae5d15ce3df9f496002508580899045 (patch)
treecf47e41c6db40ffd64c2c12be931bccb753031a4 /libavcodec/qdrw.c
parente609cfd697f8eed7325591f767585041719807d1 (diff)
lavc/qdrw: Fix overwrite when reading invalid Quickdraw images.
Diffstat (limited to 'libavcodec/qdrw.c')
-rw-r--r--libavcodec/qdrw.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/qdrw.c b/libavcodec/qdrw.c
index 6c920aa460..0bcf5dca22 100644
--- a/libavcodec/qdrw.c
+++ b/libavcodec/qdrw.c
@@ -95,6 +95,8 @@ static int decode_rle(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc,
pos -= offset;
pos++;
}
+ if (pos >= offset)
+ return AVERROR_INVALIDDATA;
}
left -= 2;
} else { /* copy */
@@ -105,6 +107,8 @@ static int decode_rle(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc,
pos -= offset;
pos++;
}
+ if (pos >= offset)
+ return AVERROR_INVALIDDATA;
}
left -= 2 + code;
}