public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/nauty] rawhide: Add patch to fix undefined behavior
@ 2026-09-03 12:50 Jerry James
  0 siblings, 0 replies; only message in thread
From: Jerry James @ 2026-09-03 12:50 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/nauty
            Branch : rawhide
            Commit : cfefabaa7f5bcb9e2ba2138ca12a5b93ffe63682
            Author : Jerry James <loganjerry@gmail.com>
            Date   : 2026-09-02T17:03:47-06:00
            Stats  : +35/-2 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/nauty/c/cfefabaa7f5bcb9e2ba2138ca12a5b93ffe63682?branch=rawhide

            Log:
            Add patch to fix undefined behavior

- Drop the -fwrapv flag
- Fix hardlinking countg and pickg

---
diff --git a/nauty-undefined-behavior.patch b/nauty-undefined-behavior.patch
new file mode 100644
index 0000000..4fe19a6
--- /dev/null
+++ b/nauty-undefined-behavior.patch
@@ -0,0 +1,31 @@
+--- nauty2_9_3/nausha.c.orig	2025-12-31 05:56:01.000000000 -0700
++++ nauty2_9_3/nausha.c	2026-09-02 12:37:44.905550503 -0600
+@@ -74,8 +74,8 @@ sha256_transform(SHA256_CTX *ctx, const
+     nsword32 a, b, c, d, e, f, g, h, i, j, t1, t2, m[64];
+ 
+     for (i = 0, j = 0; i < 16; ++i, j += 4)
+-            m[i] = (data[j] << 24) | (data[j + 1] << 16)
+-				| (data[j + 2] << 8) | (data[j + 3]);
++            m[i] = ((nsword32)data[j] << 24) | ((nsword32)data[j + 1] << 16)
++				| ((nsword32)data[j + 2] << 8) | ((nsword32)data[j + 3]);
+     for ( ; i < 64; ++i)
+             m[i] = SIG1(m[i - 2]) + m[i - 7] + SIG0(m[i - 15]) + m[i - 16];
+ 
+--- nauty2_9_3/watercluster2.c.orig	2026-09-02 12:32:28.566922114 -0600
++++ nauty2_9_3/watercluster2.c	2026-09-02 13:47:51.245804016 -0600
+@@ -3130,13 +3130,13 @@ int i,start,end, problem, sum, maxsum;
+ int getexpensivequality(graph x,graph y)
+ {
+ int j;
+-int qual=0;
++unsigned int qual=0;
+ 
+  FORALLELEMENTS(x,j) qual+=(saturated[j]<<4)-indeg_free[j];
+  qual = qual<<6;
+  FORALLELEMENTS(y,j) qual+=(saturated[j]<<4)-indeg_free[j];
+ 
+- return qual;
++ return (int)qual;
+ }
+ 
+ int is_canonical_edge(BOOG list[],int last_positie)

diff --git a/nauty.spec b/nauty.spec
index 8cc5020..392bdc8 100644
--- a/nauty.spec
+++ b/nauty.spec
@@ -30,6 +30,8 @@ Patch:          %{name}-popcnt.patch
 Patch:          %{name}-unbundle-cliquer.patch
 # Fix uninitialized variable warnings
 Patch:          %{name}-uninitialized.patch
+# Avoid undefined behavior due to left shifts of signed values
+Patch:          %{name}-undefined-behavior.patch
 
 BuildRequires:  gcc
 BuildRequires:  gmp-devel
@@ -94,7 +96,7 @@ if [ '%{_lib}' != 'lib' ]; then
 fi
 
 %build
-export CFLAGS='%{build_cflags} -fwrapv -I%{_includedir}/cliquer'
+export CFLAGS='%{build_cflags} -I%{_includedir}/cliquer'
 export LIBS='-lz-ng'
 %configure \
     --enable-ansi \
@@ -129,7 +131,7 @@ done
 
 # Link identical executables
 rm %{buildroot}%{_bindir}/pickg
-ln countg %{buildroot}%{_bindir}/pickg
+ln %{buildroot}%{_bindir}/countg %{buildroot}%{_bindir}/pickg
 
 # Move the headers
 mkdir -p %{buildroot}%{_includedir}/nauty

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-03 12:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-03 12:50 [rpms/nauty] rawhide: Add patch to fix undefined behavior Jerry James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox