aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/vp56.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-08-20 09:16:40 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-12-31 19:51:55 +0100
commit83e85e97985e7ad0b661a6366295ca8062f08782 (patch)
tree4b3ba0b75fda20556e92047e264527dbbbea8124 /libavcodec/vp56.h
parent48659851e2fc6bc342f53251191c7ef9b6f008ad (diff)
downloadffmpeg-83e85e97985e7ad0b661a6366295ca8062f08782.tar.gz
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 before 1afd246960202917e244c844c534e9c1e3c323f5) Fixes: simple_dump_cut.webm Fixes: regression of 1afd246960202917e244c844c534e9c1e3c323f5 fate-vp5 changes because the last frame is truncated and now handled differently. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit b6b9ac5698c8f911841b469af77199153278c55c) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/vp56.h')
-rw-r--r--libavcodec/vp56.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/vp56.h b/libavcodec/vp56.h
index 84b2f6c94b..65cf46870a 100644
--- a/libavcodec/vp56.h
+++ b/libavcodec/vp56.h
@@ -89,6 +89,7 @@ typedef struct VP56RangeCoder {
const uint8_t *buffer;
const uint8_t *end;
unsigned int code_word;
+ int end_reached;
} VP56RangeCoder;
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)
{
- 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)