History

avcodec/qdrw: fix decoding of odd sized images for 8bpp

Paul B Mahol committed 9 years ago

Commit 1dcf91f1 parent dc786961 file · +6 −8Browse files

Unified · Split

libavcodec/qdrw.c+6−8
@@ -231,26 +231,24 @@ static int decode_rle(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc, · 230 unmodified lines
231231 if (code & 0x80 ) { /* run */
232232 pix = bytestream2_get_byte(gbc);
233233 for (j = 0; j < 257 - code; j++) {
234− out[pos] = pix;
234+ if (pos < offset)
235+ out[pos] = pix;
235236 pos += step;
236− if (pos >= offset) {
237+ if (pos >= offset && step > 1) {
237238 pos -= offset;
238239 pos++;
239240 }
240− if (pos >= offset)
241− return AVERROR_INVALIDDATA;
242241 }
243242 left -= 2;
244243 } else { /* copy */
245244 for (j = 0; j < code + 1; j++) {
246− out[pos] = bytestream2_get_byte(gbc);
245+ if (pos < offset)
246+ out[pos] = bytestream2_get_byte(gbc);
247247 pos += step;
248− if (pos >= offset) {
248+ if (pos >= offset && step > 1) {
249249 pos -= offset;
250250 pos++;
251251 }
252− if (pos >= offset)
253− return AVERROR_INVALIDDATA;
254252 }
255253 left -= 2 + code;
256254 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t