summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartijn van Beurden <mvanb1@gmail.com>2022-08-13 16:49:11 +0200
committerMartijn van Beurden <mvanb1@gmail.com>2022-08-20 16:03:53 +0200
commit70e63b03eccd7483be79e82502d1a5aee20436ab (patch)
tree5bce27a3b152fd65b58f8015ae3c1bdd58226ad5
parenta2c8ae599ec2f9fc619198438bcc34723edcea97 (diff)
downloadflac-70e63b03eccd7483be79e82502d1a5aee20436ab.tar.gz
Throw memory allocation error when side subframe allocation fails
-rw-r--r--src/libFLAC/stream_decoder.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libFLAC/stream_decoder.c b/src/libFLAC/stream_decoder.c
index e3031a14..2c4afaa5 100644
--- a/src/libFLAC/stream_decoder.c
+++ b/src/libFLAC/stream_decoder.c
@@ -1282,8 +1282,13 @@ FLAC__bool allocate_output_(FLAC__StreamDecoder *decoder, uint32_t size, uint32_
}
}
- if(bps == 32)
+ if(bps == 32) {
decoder->private_->side_subframe = safe_malloc_mul_2op_p(sizeof(FLAC__int64), /*times (*/size);
+ if(decoder->private_->side_subframe == NULL) {
+ decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ }
decoder->private_->output_capacity = size;
decoder->private_->output_channels = channels;