Based on (hunk for changelog removed) From b62c902dd258125cac86cd2df21fc898035a43d3 Mon Sep 17 00:00:00 2001 From: Michael Pruett Date: Mon, 29 Aug 2016 23:08:26 -0500 Subject: [PATCH] Fix undefined behavior in sign conversion. --- ChangeLog | 5 +++++ libaudiofile/modules/SimpleModule.h | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libaudiofile/modules/SimpleModule.h b/libaudiofile/modules/SimpleModule.h index 03c6c69..bad85ad 100644 --- a/libaudiofile/modules/SimpleModule.h +++ b/libaudiofile/modules/SimpleModule.h @@ -123,7 +123,8 @@ struct signConverter typedef typename IntTypes::UnsignedType UnsignedType; static const int kScaleBits = (Format + 1) * CHAR_BIT - 1; - static const int kMinSignedValue = -1 << kScaleBits; + static const int kMaxSignedValue = (((1 << (kScaleBits - 1)) - 1) << 1) + 1; + static const int kMinSignedValue = -kMaxSignedValue - 1; struct signedToUnsigned : public std::unary_function { maryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2020-06-16etc: Add committer script....Ricardo Wurmus
2020-05-28maint: Check whether Guile-Gcrypt is recent enough....Ludovic Courtès
2020-05-14etc: indent-code.el: Use the --quick option....Maxim Cournoyer
2020-04-23build: Don't build man pages when cross-compiling....Ludovic Courtès
2020-03-11build: Require Guile 2.2.3 or later....Ludovic Courtès
2020-01-17build: Allow builds with Guile 3.0....Ludovic Courtès
2019-11-09build: Warn about etc/indent-code.el when Emacs is absent....zimoun
2019-07-25maint: Switch to Guile-JSON 3.x....Ludovic Courtès
2019-05-06Add (guix lzlib)....Pierre Neidhardt
2019-04-17build: No longer substitute 'LIBGCRYPT'....Ludovic Courtès
2019-01-17configure: Disable installer build by default....Mathieu Othacehe
2019-01-17gnu: Add graphical installer support....Mathieu Othacehe
2019-01-09build: Require Guile 2.2....Ludovic Courtès
2018-12-02Make Guile-JSON a required dependency....Eric Bavier