summaryrefslogtreecommitdiff
path: root/libavcodec/tiff.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/tiff.c')
-rw-r--r--libavcodec/tiff.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 436d9374aa..fdfa8f2b9e 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -577,15 +577,12 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t *dst, int stride,
code = s->fill_order ? (int8_t) ff_reverse[*src++]: (int8_t) *src++;
if (code >= 0) {
code++;
- if (pixels + code > width) {
+ if (pixels + code > width ||
+ ssrc + size - src < code) {
av_log(s->avctx, AV_LOG_ERROR,
"Copy went out of bounds\n");
return AVERROR_INVALIDDATA;
}
- if (ssrc + size - src < code) {
- av_log(s->avctx, AV_LOG_ERROR, "Read went out of bounds\n");
- return AVERROR_INVALIDDATA;
- }
horizontal_fill(s->bpp * (s->avctx->pix_fmt == AV_PIX_FMT_PAL8),
dst, 1, src, 0, code, pixels);
src += code;