mirror of https://git.ffmpeg.org/ffmpeg.git
avcodec/vp56rac: delay signaling an error on truncated input
A threshold of 1 is sufficient for simple_dump_cut.webm, 10 is used just to be sure the next truncated file doesnt cause the same issue Obvious alternative fixes are to simply accept that the file is broken or to write some advanced error concealment or to simply accept that the decoder wont stop at the end of input. Fixes: Ticket 8069 (artifacts not the differing md5 which was there before1afd246960
) Fixes: simple_dump_cut.webm Fixes: regression of1afd246960
fate-vp5 changes because the last frame is truncated and now handled differently. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commitb6b9ac5698
) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
48659851e2
commit
83e85e9798
|
@ -89,6 +89,7 @@ typedef struct VP56RangeCoder {
|
||||||
const uint8_t *buffer;
|
const uint8_t *buffer;
|
||||||
const uint8_t *end;
|
const uint8_t *end;
|
||||||
unsigned int code_word;
|
unsigned int code_word;
|
||||||
|
int end_reached;
|
||||||
} VP56RangeCoder;
|
} VP56RangeCoder;
|
||||||
|
|
||||||
typedef struct VP56RefDc {
|
typedef struct VP56RefDc {
|
||||||
|
@ -235,7 +236,9 @@ int ff_vp56_init_range_decoder(VP56RangeCoder *c, const uint8_t *buf, int buf_si
|
||||||
*/
|
*/
|
||||||
static av_always_inline int vpX_rac_is_end(VP56RangeCoder *c)
|
static av_always_inline int vpX_rac_is_end(VP56RangeCoder *c)
|
||||||
{
|
{
|
||||||
return c->end <= c->buffer && c->bits >= 0;
|
if (c->end <= c->buffer && c->bits >= 0)
|
||||||
|
c->end_reached ++;
|
||||||
|
return c->end_reached > 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_always_inline unsigned int vp56_rac_renorm(VP56RangeCoder *c)
|
static av_always_inline unsigned int vp56_rac_renorm(VP56RangeCoder *c)
|
||||||
|
|
|
@ -43,6 +43,7 @@ int ff_vp56_init_range_decoder(VP56RangeCoder *c, const uint8_t *buf, int buf_si
|
||||||
c->bits = -16;
|
c->bits = -16;
|
||||||
c->buffer = buf;
|
c->buffer = buf;
|
||||||
c->end = buf + buf_size;
|
c->end = buf + buf_size;
|
||||||
|
c->end_reached = 0;
|
||||||
if (buf_size < 1)
|
if (buf_size < 1)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
c->code_word = bytestream_get_be24(&c->buffer);
|
c->code_word = bytestream_get_be24(&c->buffer);
|
||||||
|
|
|
@ -249,4 +249,4 @@
|
||||||
0, 243, 243, 1, 233472, 0x6f530ac6
|
0, 243, 243, 1, 233472, 0x6f530ac6
|
||||||
0, 244, 244, 1, 233472, 0x94f7466c
|
0, 244, 244, 1, 233472, 0x94f7466c
|
||||||
0, 245, 245, 1, 233472, 0xa8c1d365
|
0, 245, 245, 1, 233472, 0xa8c1d365
|
||||||
0, 246, 246, 1, 233472, 0xbf73f1b7
|
0, 246, 246, 1, 233472, 0x4f3ef38c
|
||||||
|
|
Loading…
Reference in New Issue