avcodec/atrac9dec: Check init_get_bits8() for failure

Fixes: CID1439569 Unchecked return value
Fixes: CID1439578 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2024-04-28 22:57:53 +02:00
parent 63415168db
commit 615c994739
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -802,7 +802,9 @@ static int atrac9_decode_frame(AVCodecContext *avctx, AVFrame *frame,
if (ret < 0)
return ret;
init_get_bits8(&gb, avpkt->data, avpkt->size);
ret = init_get_bits8(&gb, avpkt->data, avpkt->size);
if (ret < 0)
return ret;
for (int i = 0; i < frames; i++) {
for (int j = 0; j < s->block_config->count; j++) {
@ -922,7 +924,9 @@ static av_cold int atrac9_decode_init(AVCodecContext *avctx)
return AVERROR_INVALIDDATA;
}
init_get_bits8(&gb, avctx->extradata + 4, avctx->extradata_size);
err = init_get_bits8(&gb, avctx->extradata + 4, avctx->extradata_size);
if (err < 0)
return err;
if (get_bits(&gb, 8) != 0xFE) {
av_log(avctx, AV_LOG_ERROR, "Incorrect magic byte!\n");