From e89bf8be7ac5d351092b89d10300d3b5297f9710 Mon Sep 17 00:00:00 2001 From: Timm Bäder Date: Jan 04 2021 12:43:36 +0000 Subject: Fix an integer overflow warning Recent GCC versions emit warnings like this during compilation: :10:31: warning: integer overflow in expression of type 'int' results in '-2147483648' [-Woverflow] 10 | const uint32_t limits[] = { -minInt, maxInt }; | ^~~~~~~ :10:31: warning: narrowing conversion of '-2147483648' from 'int' to 'uint32_t' {aka 'unsigned int'} [-Wnarrowing] And clang even treats them like an error. --- diff --git a/audiofile.spec b/audiofile.spec index 1073cb5..9cd17a5 100644 --- a/audiofile.spec +++ b/audiofile.spec @@ -3,7 +3,7 @@ Summary: Library for accessing various audio file formats Name: audiofile Version: 0.3.6 -Release: 25%{?dist} +Release: 26%{?dist} Epoch: 1 # library is LGPL / the two programs GPL / see README License: LGPLv2+ and GPLv2+ @@ -28,6 +28,7 @@ Patch5: audiofile-0.3.6-pull44.patch Patch6: 822b732fd31ffcb78f6920001e9b1fbd815fa712.patch Patch7: 941774c8c0e79007196d7f1e7afdc97689f869b3.patch Patch8: fde6d79fb8363c4a329a184ef0b107156602b225.patch +Patch9: integer-overflow.patch %description The Audio File library is an implementation of the Audio File Library @@ -57,6 +58,7 @@ other resources you can use to develop Audio File applications. %patch6 -p1 -b .CVE-2018-17095 %patch7 -p1 -b .CVE-2018-13440 %patch8 -p1 -b .CVE-2018-13440 +%patch9 -p1 -b .integer-overflow %build @@ -95,6 +97,9 @@ make check %{_mandir}/man3/* %changelog +* Mon Jan 04 2021 Timm Bäder - 1:0.3.6-26 +- Fix a integer overflow warning with gcc and error with clang + * Mon Jul 27 2020 Fedora Release Engineering - 1:0.3.6-25 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild diff --git a/integer-overflow.patch b/integer-overflow.patch new file mode 100644 index 0000000..7465463 --- /dev/null +++ b/integer-overflow.patch @@ -0,0 +1,12 @@ +diff -ruN audiofile-0.3.6.orig/test/Sign.cpp audiofile-0.3.6/test/Sign.cpp +--- audiofile-0.3.6.orig/test/Sign.cpp 2021-01-04 12:50:58.563336280 +0100 ++++ audiofile-0.3.6/test/Sign.cpp 2021-01-04 13:00:55.536214264 +0100 +@@ -157,7 +157,7 @@ + AFframecount framesRead = afReadFrames(file, AF_DEFAULT_TRACK, readData, frameCount); + ASSERT_EQ(framesRead, frameCount); + afCloseFile(file); +- const uint32_t expectedData[] = { 0, -kMinInt32, kMaxUInt32 }; ++ const uint32_t expectedData[] = { 0, static_cast(-kMinInt32), kMaxUInt32 }; + for (int i=0; i