diff options
author | Martijn van Beurden <mvanb1@gmail.com> | 2022-08-13 16:49:11 +0200 |
---|---|---|
committer | Martijn van Beurden <mvanb1@gmail.com> | 2022-08-20 16:03:53 +0200 |
commit | 70e63b03eccd7483be79e82502d1a5aee20436ab (patch) | |
tree | 5bce27a3b152fd65b58f8015ae3c1bdd58226ad5 /src | |
parent | a2c8ae599ec2f9fc619198438bcc34723edcea97 (diff) | |
download | flac-70e63b03eccd7483be79e82502d1a5aee20436ab.tar.gz |
Throw memory allocation error when side subframe allocation fails
Diffstat (limited to 'src')
-rw-r--r-- | src/libFLAC/stream_decoder.c | 7 |
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; |