diff --git a/abc-null-fprintf.patch b/abc-null-fprintf.patch new file mode 100644 index 0000000..1bfd75d --- /dev/null +++ b/abc-null-fprintf.patch @@ -0,0 +1,11 @@ +--- src/base/exor/exorUtil.c.orig 2022-10-19 06:05:56.000000000 -0600 ++++ src/base/exor/exorUtil.c 2022-11-16 11:40:26.252322689 -0700 +@@ -189,7 +189,7 @@ int WriteResultIntoFile( char * pFileNam + pFile = fopen( pFileName, "w" ); + if ( pFile == NULL ) + { +- fprintf( pFile, "\n\nCannot open the output file\n" ); ++ fprintf( stderr, "\n\nCannot open the output file\n" ); + return 1; + } + diff --git a/abc-use-after-free.patch b/abc-use-after-free.patch new file mode 100644 index 0000000..6c4ee43 --- /dev/null +++ b/abc-use-after-free.patch @@ -0,0 +1,23 @@ +--- src/base/cmd/cmdLoad.c.orig 2022-10-19 06:05:56.000000000 -0600 ++++ src/base/cmd/cmdLoad.c 2022-11-16 11:26:13.394889017 -0700 +@@ -58,8 +58,8 @@ int CmdCommandLoad( Abc_Frame_t * pAbc, + // check if there is the binary + if ( (pFile = fopen( Vec_StrArray(vCommand), "r" )) == NULL ) + { +- Vec_StrFree( vCommand ); + Abc_Print( -1, "Cannot run the binary \"%s\".\n\n", Vec_StrArray(vCommand) ); ++ Vec_StrFree( vCommand ); + return 1; + } + fclose( pFile ); +@@ -74,9 +74,9 @@ int CmdCommandLoad( Abc_Frame_t * pAbc, + // run the command line + if ( Util_SignalSystem( Vec_StrArray(vCommand) ) ) + { +- Vec_StrFree( vCommand ); + Abc_Print( -1, "The following command has returned non-zero exit status:\n" ); + Abc_Print( -1, "\"%s\"\n", Vec_StrArray(vCommand) ); ++ Vec_StrFree( vCommand ); + return 1; + } + Vec_StrFree( vCommand ); diff --git a/abc-weaken-assert.patch b/abc-weaken-assert.patch new file mode 100644 index 0000000..57ca3e8 --- /dev/null +++ b/abc-weaken-assert.patch @@ -0,0 +1,11 @@ +--- src/base/io/ioWritePla.c.orig 2022-10-19 06:05:56.000000000 -0600 ++++ src/base/io/ioWritePla.c 2022-11-21 11:18:23.452898568 -0700 +@@ -174,7 +174,7 @@ int Io_WritePla( Abc_Ntk_t * pNtk, char + FILE * pFile; + + assert( Abc_NtkIsSopNetlist(pNtk) ); +- assert( Abc_NtkLevel(pNtk) == 1 ); ++ assert( Abc_NtkLevel(pNtk) <= 1 ); + + pFile = fopen( pFileName, "w" ); + if ( pFile == NULL ) diff --git a/abc.spec b/abc.spec index 001dfa2..f6d8af9 100644 --- a/abc.spec +++ b/abc.spec @@ -1,8 +1,7 @@ # Upstream doesn't make releases. We have to check the code out of git. -%global owner berkeley-abc -%global gittag a9237f50ea01efdd62f86d334a38ffbe80a3d141 +%global gittag 66a5fe7aecd88d3fb0a70cc87aacc642b2d67c8c %global shorttag %(cut -b -7 <<< %{gittag}) -%global gitdate 20220731 +%global gitdate 20221229 # WARNING: When updating to a newer snapshot, because upstream doesn't do # shared library versioning, run abipkgdiff (from libabigail) against the @@ -22,7 +21,7 @@ Name: abc Version: 1.01 -Release: 35.git%{gitdate}%{?dist} +Release: 36.git%{gitdate}%{?dist} Summary: Sequential logic synthesis and formal verification # The ABC code itself is MIT-Modern-Variant. @@ -32,7 +31,7 @@ Summary: Sequential logic synthesis and formal verification # The bundled satoko code is BSD-2-Clause License: MIT-Modern-Variant AND MIT AND BSD-2-Clause AND BSD-3-Clause URL: https://people.eecs.berkeley.edu/~alanmi/abc/abc.htm -Source0: https://github.com/%{owner}/%{name}/archive/%{gittag}/%{name}-%{shorttag}.tar.gz +Source0: https://github.com/berkeley-abc/abc/archive/%{gittag}/%{name}-%{shorttag}.tar.gz # Man page created by Jerry James using upstream text; hence, it is covered by # the same copyright and license as the code. Source1: %{name}.1 @@ -51,6 +50,15 @@ Patch4: %{name}-format.patch Patch5: %{name}-gia.patch # Prevent a possible buffer overflow Patch6: %{name}-overflow.patch +# Fix two cases of use-after-free +# https://github.com/berkeley-abc/abc/pull/193 +Patch7: %{name}-use-after-free.patch +# Do not pass NULL to fprintf +# https://github.com/berkeley-abc/abc/pull/194 +Patch8: %{name}-null-fprintf.patch +# Weaken an overzealous assert +# https://bitbucket.org/alanmi/abc/issue/27/assertion-failure-in-write_pla-command +Patch9: %{name}-weaken-assert.patch BuildRequires: cmake BuildRequires: gcc-c++ @@ -101,7 +109,7 @@ Headers and libraries for developing applications that use ABC. %prep %autosetup -p0 -n %{name}-%{gittag} -# Do not use the bundled bzip2, zlib, or Windows libraries +# Do not use the bundled bzip2 or zlib libraries rm -fr lib src/misc/{bzlib,zlib} # Set the version number in the man page @@ -112,11 +120,12 @@ touch -r %{SOURCE1} %{name}.1 sed -i 's/ -O//' Makefile %build -export CFLAGS="%{build_cflags} -DNDEBUG" +export CFLAGS='%{build_cflags} -DNDEBUG' +export CXXFLAGS='%{build_cxxflags} -DNDEBUG' %ifarch s390x CFLAGS="$CFLAGS -DEPD_BIG_ENDIAN" +CXXFLAGS="$CXXFLAGS -DEPD_BIG_ENDIAN" %endif -export CXXFLAGS="$CFLAGS" export ABC_MAKE_VERBOSE=1 export ABC_USE_STDINT_H=1 %cmake -DCMAKE_SKIP_RPATH:BOOL=YES -DCMAKE_SKIP_INSTALL_RPATH:BOOL=YES @@ -138,8 +147,8 @@ cd - # Install the header files cd src mkdir -p %{buildroot}%{_includedir}/%{name} -tar -cBf - $(find -O3 . -name \*.h) | \ - (cd %{buildroot}%{_includedir}/%{name}; tar -xBf -) +tar -cf - $(find -O3 . -name \*.h) | \ + (cd %{buildroot}%{_includedir}/%{name}; tar -xf -) cd - # Install the man page @@ -153,13 +162,18 @@ install -p -m 0644 %{name}.1 %{buildroot}%{_mandir}/man1 %files libs %license copyright.txt -%{_libdir}/lib%{name}.so.* +%{_libdir}/lib%{name}.so.0* %files devel %{_includedir}/%{name}/ %{_libdir}/lib%{name}.so %changelog +* Tue Jan 17 2023 Jerry James - 1.01-36.git20221229 +- Update to latest git snapshot +- Add -use-after-free, -null-fprintf, and -weaken-assert patches +- Minor spec file cleanups + * Mon Aug 1 2022 Jerry James - 1.01-35.git20220731 - Update to latest git snapshot - Convert License field to SPDX diff --git a/sources b/sources index b9139dd..97fbc0b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (abc-a9237f5.tar.gz) = bfad8fdd23fe869df6cf86dc3a1a4e9058a23487a6237043e3466f728b2830010e842ad3d3811352371f3dfbe1cd4c7d32999a8507aeae7d758f2ff52e2397b2 +SHA512 (abc-66a5fe7.tar.gz) = 1bd28a063e4d30727ca911f47f5fe8ecea1c08feecefcc459c1839b5b6df83c3f6393de8379195481171aa137150a847d4cef052fbfaba194dd7cb428c433254