summaryrefslogtreecommitdiff
path: root/app-shells/bash/files
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-01-11 07:43:47 +0000
committerSam James <sam@gentoo.org>2023-01-11 07:48:29 +0000
commitc834e23a32d262a415a7d553e5bd6c6460b0d38a (patch)
tree86ea2e9db8c02270af7c459460097fbe8d065a24 /app-shells/bash/files
parente7da4786d4169109aceccce962301254767166cd (diff)
downloadgentoo-c834e23a32d262a415a7d553e5bd6c6460b0d38a.tar.gz
gentoo-c834e23a32d262a415a7d553e5bd6c6460b0d38a.tar.bz2
gentoo-c834e23a32d262a415a7d553e5bd6c6460b0d38a.zip
app-shells/bash: backport random UB fix
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'app-shells/bash/files')
-rw-r--r--app-shells/bash/files/bash-5.2_p15-random-ub.patch13
1 files changed, 13 insertions, 0 deletions
diff --git a/app-shells/bash/files/bash-5.2_p15-random-ub.patch b/app-shells/bash/files/bash-5.2_p15-random-ub.patch
new file mode 100644
index 000000000000..d4dc060b510a
--- /dev/null
+++ b/app-shells/bash/files/bash-5.2_p15-random-ub.patch
@@ -0,0 +1,13 @@
+https://lists.gnu.org/archive/html/bug-bash/2023-01/msg00016.html
+https://git.savannah.gnu.org/cgit/bash.git/commit/?h=devel&id=0647e53bd15c8982d89a03c2db1643aedd7cd649
+
+--- lib/sh/random.c
++++ lib/sh/random.c
+@@ -75,7 +75,7 @@ u_bits32_t last;
+ /* Can't seed with 0. */
+ ret = (last == 0) ? 123459876 : last;
+ h = ret / 127773;
+- l = ret - (127773 * h);
++ l = ret % 127773;
+ t = 16807 * l - 2836 * h;
+ ret = (t < 0) ? t + 0x7fffffff : t;