Commit 1eda5551 authored by Carl Eugen Hoyos's avatar Carl Eugen Hoyos

lavc/qdrw: Fix overwrite when reading invalid Quickdraw images.

parent e609cfd6
...@@ -95,6 +95,8 @@ static int decode_rle(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc, ...@@ -95,6 +95,8 @@ static int decode_rle(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc,
pos -= offset; pos -= offset;
pos++; pos++;
} }
if (pos >= offset)
return AVERROR_INVALIDDATA;
} }
left -= 2; left -= 2;
} else { /* copy */ } else { /* copy */
...@@ -105,6 +107,8 @@ static int decode_rle(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc, ...@@ -105,6 +107,8 @@ static int decode_rle(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc,
pos -= offset; pos -= offset;
pos++; pos++;
} }
if (pos >= offset)
return AVERROR_INVALIDDATA;
} }
left -= 2 + code; left -= 2 + code;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment