From 6a399854517f0f89a76651ea53f9b8dea16d3ef2 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 26 Jan 2013 22:04:49 +0100 Subject: [PATCH 1/3] cmdutils: remove ansi from the list of broken codecs. It's not relying on get_buffer() initializing the frame since 99e36ddd3ee57c38e6ca9e240ba518848487f849. --- cmdutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmdutils.c b/cmdutils.c index 9aec9ae5ae..360ba39f13 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -1566,7 +1566,7 @@ static int alloc_buffer(FrameBuffer **pool, AVCodecContext *s, FrameBuffer **pbu /* XXX this shouldn't be needed, but some tests break without this line * those decoders are buggy and need to be fixed. * the following tests fail: - * ansi, aasc, fraps-v1, qtrle-1bit + * aasc, fraps-v1, qtrle-1bit */ memset(buf->base[0], 128, ret); From 9bd6375d5f16842306dcecde637ffe605acda26b Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 29 Jan 2013 12:24:09 +0100 Subject: [PATCH 2/3] msrledec: check bounds before constructing a possibly invalid pointer, CC:libav-stable@libav.org --- libavcodec/msrledec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/msrledec.c b/libavcodec/msrledec.c index fad94151c9..af2a2478b1 100644 --- a/libavcodec/msrledec.c +++ b/libavcodec/msrledec.c @@ -144,8 +144,7 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, if(p1 == 0) { //Escape code p2 = bytestream2_get_byte(gb); if(p2 == 0) { //End-of-line - output = pic->data[0] + (--line) * pic->linesize[0]; - if (line < 0) { + if (--line < 0) { if (bytestream2_get_be16(gb) == 1) { // end-of-picture return 0; } else { @@ -155,6 +154,7 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, return AVERROR_INVALIDDATA; } } + output = pic->data[0] + line * pic->linesize[0]; pos = 0; continue; } else if(p2 == 1) { //End-of-picture From da7baaaae79b4d7d715d35ea6bcfbdd149edc177 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 29 Jan 2013 12:42:54 +0100 Subject: [PATCH 3/3] aasc: fix output for msrle compression. The bottom line was invalid before. CC:libav-stable@libav.org --- cmdutils.c | 2 +- libavcodec/aasc.c | 2 +- tests/ref/fate/aasc | 46 ++++++++++++++++++++++----------------------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/cmdutils.c b/cmdutils.c index 360ba39f13..dbe22e3ea4 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -1566,7 +1566,7 @@ static int alloc_buffer(FrameBuffer **pool, AVCodecContext *s, FrameBuffer **pbu /* XXX this shouldn't be needed, but some tests break without this line * those decoders are buggy and need to be fixed. * the following tests fail: - * aasc, fraps-v1, qtrle-1bit + * fraps-v1, qtrle-1bit */ memset(buf->base[0], 128, ret); diff --git a/libavcodec/aasc.c b/libavcodec/aasc.c index 7759c71a2f..823dcee4d5 100644 --- a/libavcodec/aasc.c +++ b/libavcodec/aasc.c @@ -77,7 +77,7 @@ static int aasc_decode_frame(AVCodecContext *avctx, } break; case 1: - bytestream2_init(&s->gb, buf - 4, buf_size + 4); + bytestream2_init(&s->gb, buf, buf_size); ff_msrle_decode(avctx, (AVPicture*)&s->frame, 8, &s->gb); break; default: diff --git a/tests/ref/fate/aasc b/tests/ref/fate/aasc index b991635715..57d59a9c48 100644 --- a/tests/ref/fate/aasc +++ b/tests/ref/fate/aasc @@ -1,24 +1,24 @@ #tb 0: 1/25 -0, 0, 0, 1, 168000, 0x45addf8f -0, 1, 1, 1, 168000, 0x45addf8f -0, 2, 2, 1, 168000, 0x45addf8f -0, 3, 3, 1, 168000, 0x45addf8f -0, 4, 4, 1, 168000, 0x45addf8f -0, 5, 5, 1, 168000, 0x45addf8f -0, 6, 6, 1, 168000, 0x45addf8f -0, 7, 7, 1, 168000, 0x45addf8f -0, 8, 8, 1, 168000, 0x45addf8f -0, 9, 9, 1, 168000, 0x45addf8f -0, 10, 10, 1, 168000, 0x45addf8f -0, 11, 11, 1, 168000, 0x45addf8f -0, 12, 12, 1, 168000, 0x8730699b -0, 13, 13, 1, 168000, 0x08b095df -0, 14, 14, 1, 168000, 0x203526e3 -0, 15, 15, 1, 168000, 0x0ebc5142 -0, 16, 16, 1, 168000, 0xd168e7c2 -0, 17, 17, 1, 168000, 0xcc7da0e6 -0, 18, 18, 1, 168000, 0x72ac60b8 -0, 19, 19, 1, 168000, 0xb691e27c -0, 20, 20, 1, 168000, 0x646fa087 -0, 21, 21, 1, 168000, 0x404450a2 -0, 22, 22, 1, 168000, 0x5214c456 +0, 0, 0, 1, 168000, 0x00000000 +0, 1, 1, 1, 168000, 0x00000000 +0, 2, 2, 1, 168000, 0x00000000 +0, 3, 3, 1, 168000, 0x00000000 +0, 4, 4, 1, 168000, 0x00000000 +0, 5, 5, 1, 168000, 0x00000000 +0, 6, 6, 1, 168000, 0x00000000 +0, 7, 7, 1, 168000, 0x00000000 +0, 8, 8, 1, 168000, 0x00000000 +0, 9, 9, 1, 168000, 0x00000000 +0, 10, 10, 1, 168000, 0x00000000 +0, 11, 11, 1, 168000, 0x00000000 +0, 12, 12, 1, 168000, 0xa6298d46 +0, 13, 13, 1, 168000, 0x5d89d96c +0, 14, 14, 1, 168000, 0x16d994da +0, 15, 15, 1, 168000, 0xa8c6079b +0, 16, 16, 1, 168000, 0xdd1decac +0, 17, 17, 1, 168000, 0x6a96003c +0, 18, 18, 1, 168000, 0xef7f1ff4 +0, 19, 19, 1, 168000, 0x90dc0126 +0, 20, 20, 1, 168000, 0x7a2b1006 +0, 21, 21, 1, 168000, 0xc7ca1345 +0, 22, 22, 1, 168000, 0x8841c413