diff options
author | Martijn van Beurden <mvanb1@gmail.com> | 2022-05-20 21:30:50 +0200 |
---|---|---|
committer | Martijn van Beurden <mvanb1@gmail.com> | 2022-05-20 22:48:38 +0200 |
commit | bcb7ed12b9d241f882302d38cbd7f5c821112734 (patch) | |
tree | c7c6edf817ce230fa7fbdf0156577f5049599146 /src | |
parent | 69cf76c58e797d093cea73b1f8ad1ff55ec2786d (diff) | |
download | flac-bcb7ed12b9d241f882302d38cbd7f5c821112734.tar.gz |
Default to picture type other when unknown picture type is found
When an unknown picture type was found, the resulting type wouldn't
occur in the enum, which is undefined behaviour. This commit changes
the picture type to 0 (other) when that happens.
Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=46964
Diffstat (limited to 'src')
-rw-r--r-- | src/libFLAC/stream_decoder.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libFLAC/stream_decoder.c b/src/libFLAC/stream_decoder.c index f085e3be..eab9e8b4 100644 --- a/src/libFLAC/stream_decoder.c +++ b/src/libFLAC/stream_decoder.c @@ -1904,7 +1904,10 @@ FLAC__bool read_metadata_picture_(FLAC__StreamDecoder *decoder, FLAC__StreamMeta /* read type */ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_PICTURE_TYPE_LEN)) return false; /* read_callback_ sets the state for us */ - obj->type = x; + if(x < FLAC__STREAM_METADATA_PICTURE_TYPE_UNDEFINED) + obj->type = x; + else + obj->type = FLAC__STREAM_METADATA_PICTURE_TYPE_OTHER; /* read MIME type */ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN)) |