1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 19:47:34 +00:00

LibAudio: Handle bitstream errors in MP3 Huffman decode

This commit is contained in:
kleines Filmröllchen 2023-06-28 16:41:07 +02:00 committed by Jelle Raaijmakers
parent 2ba77489ee
commit 53785a9206

View file

@ -112,9 +112,12 @@ HuffmanDecodeResult<T> huffman_decode(BigEndianInputBitStream& bitstream, Readon
size_t bits_read = 0;
while (!node->is_leaf() && max_bits_to_read-- > 0) {
bool const direction = bitstream.read_bit().release_value_but_fixme_should_propagate_errors();
auto const maybe_direction = bitstream.read_bit();
if (maybe_direction.is_error())
return { bits_read, {} };
++bits_read;
if (direction) {
if (maybe_direction.value()) {
if (node->left == -1)
return {};
node = &tree[node->left];