summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2023-02-07 16:26:14 +0100
committerPaul B Mahol <onemda@gmail.com>2023-02-07 17:13:10 +0100
commit5dba4b217c548524a93e306a3635d963ddd81c42 (patch)
tree409ca963dd2cc2af119226a053e0a201055e65dd /libavcodec
parent62dfa546886d55109f0ba0afb1c13e59157e524c (diff)
avcodec/wavarc: properly handle invalid data
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/wavarc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libavcodec/wavarc.c b/libavcodec/wavarc.c
index 956c52bfe9..6e0e66dcd8 100644
--- a/libavcodec/wavarc.c
+++ b/libavcodec/wavarc.c
@@ -371,7 +371,7 @@ static int wavarc_decode(AVCodecContext *avctx, AVFrame *frame,
}
if ((ret = init_get_bits8(gb, buf, buf_size)) < 0)
- return ret;
+ goto fail;
skip_bits(gb, s->skip);
switch (avctx->codec_tag) {
@@ -397,12 +397,14 @@ static int wavarc_decode(AVCodecContext *avctx, AVFrame *frame,
fail:
s->bitstream_size = 0;
s->bitstream_index = 0;
- return ret;
+ if (ret == AVERROR_EOF)
+ return 0;
+ return AVERROR_INVALIDDATA;
}
frame->nb_samples = s->nb_samples;
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
- return ret;
+ goto fail;
switch (avctx->sample_fmt) {
case AV_SAMPLE_FMT_U8P: