mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-09 19:16:02 +00:00
LibAudio: Handle bitstream errors in MP3 Huffman decode
This commit is contained in:
parent
2ba77489ee
commit
53785a9206
Notes:
sideshowbarker
2024-07-17 20:58:35 +09:00
Author: https://github.com/kleinesfilmroellchen
Commit: 53785a9206
Pull-request: https://github.com/SerenityOS/serenity/pull/19688
Reviewed-by: https://github.com/gmta ✅
1 changed files with 5 additions and 2 deletions
|
@ -112,9 +112,12 @@ HuffmanDecodeResult<T> huffman_decode(BigEndianInputBitStream& bitstream, Readon
|
||||||
size_t bits_read = 0;
|
size_t bits_read = 0;
|
||||||
|
|
||||||
while (!node->is_leaf() && max_bits_to_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;
|
++bits_read;
|
||||||
if (direction) {
|
if (maybe_direction.value()) {
|
||||||
if (node->left == -1)
|
if (node->left == -1)
|
||||||
return {};
|
return {};
|
||||||
node = &tree[node->left];
|
node = &tree[node->left];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue