Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
external libs: rebuilt flac decoder after applying a fix from mainstream
- Loading branch information
Showing
7 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
From: Erik de Castro Lopo <erikd@mega-nerd.com> | ||
Date: Sun, 10 Nov 2019 19:42:11 +0000 (+1100) | ||
Subject: libFLAC/bitreader.c: Fix shift invoking undefined behaviour | ||
X-Git-Url: http://git.xiph.org/?p=flac.git;a=commitdiff_plain;h=b3f55c40cc6e00ee4ae1560b5449e54d3f7012b4 | ||
|
||
libFLAC/bitreader.c: Fix shift invoking undefined behaviour | ||
|
||
Credit: Oss-Fuzz | ||
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18589 | ||
Testcase: fuzzer_decoder-5668806471188480 | ||
--- | ||
|
||
diff --git a/src/libFLAC/bitreader.c b/src/libFLAC/bitreader.c | ||
index 3df4d02c..d2c058d9 100644 | ||
--- a/src/libFLAC/bitreader.c | ||
+++ b/src/libFLAC/bitreader.c | ||
@@ -462,7 +462,7 @@ FLAC__bool FLAC__bitreader_read_raw_int32(FLAC__BitReader *br, FLAC__int32 *val, | ||
return false; | ||
/* sign-extend *val assuming it is currently bits wide. */ | ||
/* From: https://graphics.stanford.edu/~seander/bithacks.html#FixedSignExtend */ | ||
- mask = 1u << (bits - 1); | ||
+ mask = bits >= 33 ? 0 : 1u << (bits - 1); | ||
*val = (uval ^ mask) - mask; | ||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters