diff options
author | Michael Prokop <mika@debian.org> | 2024-08-16 11:41:40 +0200 |
---|---|---|
committer | Michael Prokop <mika@debian.org> | 2024-08-16 11:41:41 +0200 |
commit | 75b0275712b9123e5fa163b939f3adae8acb44f1 (patch) | |
tree | d6a5d291df9944fe42253edaba3b5cbf3a92dd5c /debian/patches/cherry-pick-727b493e-50736-silence-use-after-free-warning.patch | |
parent | 80e160d127cef9d9fd6497616b4b1e7068523205 (diff) | |
download | zsh-75b0275712b9123e5fa163b939f3adae8acb44f1.tar.gz zsh-75b0275712b9123e5fa163b939f3adae8acb44f1.zip |
Cherry-pick upstream commit 727b493e to address FTBFS on mips64el
Description from upstream:
| 50736: silence use-after-free warning (gcc-12.2)
And as noted by Chris, the patch fixes a memory issue in compmatch.c,
gcc indeed complains about that, so this hopefully fixes our FTBFS issue
on mips64el.
Thanks: Chris Hofstaedtler <zeha@debian.org>
Closes: #1078749
Diffstat (limited to 'debian/patches/cherry-pick-727b493e-50736-silence-use-after-free-warning.patch')
-rw-r--r-- | debian/patches/cherry-pick-727b493e-50736-silence-use-after-free-warning.patch | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/debian/patches/cherry-pick-727b493e-50736-silence-use-after-free-warning.patch b/debian/patches/cherry-pick-727b493e-50736-silence-use-after-free-warning.patch new file mode 100644 index 000000000..c1fc7adc4 --- /dev/null +++ b/debian/patches/cherry-pick-727b493e-50736-silence-use-after-free-warning.patch @@ -0,0 +1,36 @@ +From 727b493e2b782fca0f3933865faa9a0a6ab1a2c4 Mon Sep 17 00:00:00 2001 +From: Wesley Schwengle <wesleys@opperschaap.net> +Date: Mon, 17 Oct 2022 13:13:13 +0900 +Subject: [PATCH] 50736: silence use-after-free warning (gcc-12.2) + +--- a/Src/Zle/compmatch.c ++++ b/Src/Zle/compmatch.c +@@ -2045,12 +2045,12 @@ + zlelineasstring(line, mp->llen, 0, &convlen, + NULL, 0); + if (rr <= convlen) { +- char *or = rs; ++ ptrdiff_t diff = rp - rs; + int alloclen = (convlen > 20) ? convlen : 20; + + rs = realloc(rs, (rl += alloclen)); + rr += alloclen; +- rp += rs - or; ++ rp = rs + diff; + } + memcpy(rp, convstr, convlen); + rp += convlen; +@@ -2073,11 +2073,11 @@ + } else { + /* Same character, just take it. */ + if (rr <= 1 /* HERE charlen */) { +- char *or = rs; ++ ptrdiff_t diff = rp - rs; + + rs = realloc(rs, (rl += 20)); + rr += 20; +- rp += rs - or; ++ rp = rs + diff; + } + /* HERE: multibyte char */ + *rp++ = *sa; |