Skip to content

Commit

Permalink
external libs: rebuilt flac decoder after applying a fix from mainstream
Browse files Browse the repository at this point in the history
  • Loading branch information
sezero committed Nov 11, 2019
1 parent c5df1d5 commit 70fe970
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 3 deletions.
Binary file modified VisualC/external/lib/x64/libFLAC-8.dll
Binary file not shown.
Binary file modified VisualC/external/lib/x86/libFLAC-8.dll
Binary file not shown.
Binary file modified Xcode/Frameworks/FLAC.framework/Versions/A/FLAC
Binary file not shown.
14 changes: 13 additions & 1 deletion external/flac-1.3.3/0005-flac.git-04974d27.patch
Expand Up @@ -6,6 +6,18 @@ X-Git-Url: http://git.xiph.org/?p=flac.git;a=commitdiff_plain;h=04974d271531d429
Fix a number of gcc 9.2 compiler warnings
---

From: sezero <sezero@users.sourceforge.net>
Date: Sun, 10 Nov 2019 22:12:28 +0000 (+0300)
Subject: flac/main.c: replace an snprintf() call with flac_snprintf()
X-Git-Url: http://git.xiph.org/?p=flac.git;a=commitdiff_plain;h=2907d4921cc4e46751c18478f5cbe1d60ce50cac

flac/main.c: replace an snprintf() call with flac_snprintf()

flac_snprintf() is used everywhere else in there. that single instance
of plain snprintf() was added in commit 04974d27. fixes flac.exe build
with older msvc versions.
---

diff --git a/include/share/safe_str.h b/include/share/safe_str.h
index eb974c51..6709334e 100644
--- a/include/share/safe_str.h
Expand Down Expand Up @@ -45,7 +57,7 @@ index be072a3d..780ccc50 100644
}
- safe_strncpy(internal_outfilename, outfilename, dest_len);
- safe_strncat(internal_outfilename, tmp_suffix, dest_len);
+ snprintf(internal_outfilename, dest_len, "%s%s", outfilename, tmp_suffix);
+ flac_snprintf(internal_outfilename, dest_len, "%s%s", outfilename, tmp_suffix);
}

if(input_format == FORMAT_RAW) {
Expand Down
25 changes: 25 additions & 0 deletions external/flac-1.3.3/0015-flac.git-b3f55c40.patch
@@ -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;
}
2 changes: 1 addition & 1 deletion external/flac-1.3.3/src/flac/main.c
Expand Up @@ -1933,7 +1933,7 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_
conditional_fclose(encode_infile);
return 1;
}
snprintf(internal_outfilename, dest_len, "%s%s", outfilename, tmp_suffix);
flac_snprintf(internal_outfilename, dest_len, "%s%s", outfilename, tmp_suffix);
}

if(input_format == FORMAT_RAW) {
Expand Down
2 changes: 1 addition & 1 deletion external/flac-1.3.3/src/libFLAC/bitreader.c
Expand Up @@ -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;
}
Expand Down

0 comments on commit 70fe970

Please sign in to comment.