python3.14-scipy/bundled-xfs-coverity-fixes.patch
Charalampos Stratakis 1d011fa00c Fix issues uncovered via coverity scanning
Related: RHEL-120852
2026-02-10 14:18:24 +01:00

71 lines
2.3 KiB
Diff

From 7f973498c9c628cd4f1d04272ea9bf81ec150912 Mon Sep 17 00:00:00 2001
From: Charalampos Stratakis <cstratak@redhat.com>
Date: Sat, 20 Dec 2025 01:40:34 +0100
Subject: [PATCH 1/2] BUG: amos/amos.h: fix pointer dereference in uni2
The code was performing pointer arithmetic instead of incrementing
the value, unlike the identical pattern in uni1.
Found by coverity static analysis.
---
subprojects/xsf/include/xsf/amos/amos.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/subprojects/xsf/include/xsf/amos/amos.h b/subprojects/xsf/include/xsf/amos/amos.h
index 08d4ef5..48c0fff 100644
--- a/subprojects/xsf/include/xsf/amos/amos.h
+++ b/subprojects/xsf/include/xsf/amos/amos.h
@@ -5304,7 +5304,7 @@ namespace amos {
// SET UNDERFLOW AND UPDATE PARAMETERS
//
y[nd - 1] = 0.0;
- nz += 1;
+ *nz += 1;
nd -= 1;
if (nd == 0) {
return;
@@ -5312,7 +5312,7 @@ namespace amos {
nuf = uoik(z, fnu, kode, 1, nd, y, tol, elim, alim);
if (nuf >= 0) {
nd -= nuf;
- nz += nuf;
+ *nz += nuf;
if (nd == 0) {
return;
}
--
2.53.0
From 8ff3b3f02eb7e35f3741a72c078ba49f8b8de3db Mon Sep 17 00:00:00 2001
From: Charalampos Stratakis <cstratak@redhat.com>
Date: Wed, 28 Jan 2026 01:54:42 +0100
Subject: [PATCH 2/2] BUG: specfun/specfun.h: initialize kd in mtu12 to fix
potential uninitialized use
The kd variable was not initialized before the kf==1/kf==2 conditional
blocks. If kf had an unexpected value, kd would be used uninitialized
when passed to cva2(). Initialize to 0 for consistency with mtu0.
Uncovered by Coverity static analysis.
---
subprojects/xsf/include/xsf/specfun/specfun.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/subprojects/xsf/include/xsf/specfun/specfun.h b/subprojects/xsf/include/xsf/specfun/specfun.h
index 6247601..a5a3ac6 100644
--- a/subprojects/xsf/include/xsf/specfun/specfun.h
+++ b/subprojects/xsf/include/xsf/specfun/specfun.h
@@ -4759,7 +4759,7 @@ namespace specfun {
T eps = 1.0e-14;
T a, qm, c1, c2, u1, u2, w1, w2;
- int kd, km, ic, k, nm = 0;
+ int kd = 0, km, ic, k, nm = 0;
if ((kf == 1) && (m % 2 == 0)) {
kd = 1;
--
2.53.0