SecBSD's official ports repository

This commit is contained in:
purplerain 2023-08-16 22:26:55 +00:00
commit 2c0afcbbf3
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
64331 changed files with 5339189 additions and 0 deletions

View file

@ -0,0 +1,16 @@
Fix undefined behavior in sign conversion.
https://github.com/mpruett/audiofile/commit/b62c902dd258125cac86cd2df21fc898035a43d3
Index: libaudiofile/modules/SimpleModule.h
--- libaudiofile/modules/SimpleModule.h.orig
+++ libaudiofile/modules/SimpleModule.h
@@ -123,7 +123,8 @@ struct signConverter
typedef typename IntTypes<Format>::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<SignedType, UnsignedType>
{