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 with undefined behavior fixes from mainst…
…ream
- Loading branch information
Showing
12 changed files
with
98 additions
and
68 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
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,21 @@ | ||
From: Andrey Astafyev <dev@246060.ru> | ||
Date: Fri, 29 Nov 2019 17:03:25 +0000 (+0300) | ||
Subject: Both files are checked for EOF | ||
X-Git-Url: http://git.xiph.org/?p=flac.git;a=commitdiff_plain;h=6455e477218360899c55f8dbd06c6628260d4123 | ||
|
||
Both files are checked for EOF | ||
--- | ||
|
||
diff --git a/src/utils/flacdiff/main.cpp b/src/utils/flacdiff/main.cpp | ||
index f86b8bbd..6a42db15 100644 | ||
--- a/src/utils/flacdiff/main.cpp | ||
+++ b/src/utils/flacdiff/main.cpp | ||
@@ -166,7 +166,7 @@ static FLAC__off_t get_diff_offset(AutoFILE &f1, AutoFILE &f2) | ||
{ | ||
FLAC__off_t off = 0; | ||
while(1) { | ||
- if(feof((FILE*)f1) && feof((FILE*)f1)) { | ||
+ if(feof((FILE*)f1) && feof((FILE*)f2)) { | ||
fprintf(stderr, "ERROR: files are identical\n"); | ||
return -1; | ||
} |
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
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,35 @@ | ||
From: Erik de Castro Lopo <erikd@mega-nerd.com> | ||
Date: Sun, 24 Nov 2019 03:14:50 +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=b02e1593525f63aaa4c671e034ff8f0cdc641e46 | ||
|
||
libFLAC/bitreader.c: Fix shift invoking undefined behaviour | ||
|
||
Credit: Oss-Fuzz | ||
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19067 | ||
Testcase: fuzzer_decoder-5725157960450048 | ||
--- | ||
|
||
diff --git a/src/libFLAC/bitreader.c b/src/libFLAC/bitreader.c | ||
index e94f8b01..79cb5cc4 100644 | ||
--- a/src/libFLAC/bitreader.c | ||
+++ b/src/libFLAC/bitreader.c | ||
@@ -405,7 +405,8 @@ FLAC__bool FLAC__bitreader_read_raw_uint32(FLAC__BitReader *br, FLAC__uint32 *va | ||
const brword word = br->buffer[br->consumed_words]; | ||
const brword mask = br->consumed_bits < FLAC__BITS_PER_WORD ? FLAC__WORD_ALL_ONES >> br->consumed_bits : 0; | ||
if(bits < n) { | ||
- *val = (FLAC__uint32)((word & mask) >> (n-bits)); /* The result has <= 32 non-zero bits */ | ||
+ uint32_t shift = n - bits; | ||
+ *val = shift < FLAC__BITS_PER_WORD ? (FLAC__uint32)((word & mask) >> shift) : 0; /* The result has <= 32 non-zero bits */ | ||
br->consumed_bits += bits; | ||
return true; | ||
} | ||
@@ -670,7 +671,7 @@ FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, uint32_t *va | ||
*val = 0; | ||
while(1) { | ||
while(br->consumed_words < br->words) { /* if we've not consumed up to a partial tail word... */ | ||
- brword b = br->buffer[br->consumed_words] << br->consumed_bits; | ||
+ brword b = br->consumed_bits < FLAC__BITS_PER_WORD ? br->buffer[br->consumed_words] << br->consumed_bits : 0; | ||
if(b) { | ||
i = COUNT_ZERO_MSBS(b); | ||
*val += i; |
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