summaryrefslogtreecommitdiff
path: root/libavcodec/flac.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-12-03 23:39:11 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2016-12-03 23:39:11 +0100
commit6567c59c4903194eeaf822aeb88b7b8dbda1354b (patch)
tree73728b93ca4513ca0b8bf824d21b1b3f8cdad2e2 /libavcodec/flac.c
parent020d53ebdb581ea5a493239537cb0f5cc54809e9 (diff)
avcodec/flac: forward errors from ff_flac_parse_streaminfo()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/flac.c')
-rw-r--r--libavcodec/flac.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/flac.c b/libavcodec/flac.c
index 069cde442b..5ffbf93190 100644
--- a/libavcodec/flac.c
+++ b/libavcodec/flac.c
@@ -201,7 +201,7 @@ void ff_flac_set_channel_layout(AVCodecContext *avctx)
avctx->channel_layout = 0;
}
-void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
+int ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
const uint8_t *buffer)
{
GetBitContext gb;
@@ -213,6 +213,7 @@ void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
av_log(avctx, AV_LOG_WARNING, "invalid max blocksize: %d\n",
s->max_blocksize);
s->max_blocksize = 16;
+ return AVERROR_INVALIDDATA;
}
skip_bits(&gb, 24); /* skip min frame size */
@@ -225,6 +226,7 @@ void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
if (s->bps < 4) {
av_log(avctx, AV_LOG_ERROR, "invalid bps: %d\n", s->bps);
s->bps = 16;
+ return AVERROR_INVALIDDATA;
}
avctx->channels = s->channels;
@@ -239,4 +241,6 @@ void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
skip_bits_long(&gb, 64); /* md5 sum */
skip_bits_long(&gb, 64); /* md5 sum */
+
+ return 0;
}