summaryrefslogtreecommitdiff
path: root/libavcodec/dvdsubdec.c
diff options
context:
space:
mode:
authorwm4 <nfxjfg@googlemail.com>2015-05-28 14:30:14 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-05-28 15:31:07 +0200
commit0ad04bf6a29ee54374370d9fe1a6543439d6aa02 (patch)
treeb87ef56c5c54a66116e2efb2f4c2b42508d9ba4d /libavcodec/dvdsubdec.c
parentb06e82e73897e7afd1363f60015f5cbf6d39c984 (diff)
dvdsubdec: reset buffer size on invalid over-large packets
Otherwise it will never be reset, and remain "stuck" in this state forever. Can happen when seeking: the decoder will receive fragments from different file positions, which triggers the condition easily. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/dvdsubdec.c')
-rw-r--r--libavcodec/dvdsubdec.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index 673fc6051e..a87a3bcdd4 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -519,6 +519,7 @@ static int append_to_cached_buf(AVCodecContext *avctx,
if (ctx->buf_size >= sizeof(ctx->buf) - buf_size) {
av_log(avctx, AV_LOG_WARNING, "Attempt to reconstruct "
"too large SPU packets aborted.\n");
+ ctx->buf_size = 0;
return AVERROR_INVALIDDATA;
}
memcpy(ctx->buf + ctx->buf_size, buf, buf_size);