diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2025-02-13 11:20:59 -0600 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2025-02-13 11:20:59 -0600 |
commit | ab3298753ca39c1df54a292b636a38a5b0e72288 (patch) | |
tree | 59aeea7f4c96d047aec53e9ea4e2951d3916ec6e /system/musl/0002-iconv-harden-UTF-8-output-code-path-against-input-de.patch | |
parent | 9b201769d0fde905fafb4732bca4df77b3cccb80 (diff) | |
download | packages-ab3298753ca39c1df54a292b636a38a5b0e72288.tar.gz packages-ab3298753ca39c1df54a292b636a38a5b0e72288.tar.bz2 packages-ab3298753ca39c1df54a292b636a38a5b0e72288.tar.xz packages-ab3298753ca39c1df54a292b636a38a5b0e72288.zip |
system/musl: [CVE] Patch for CVE-2025-26519
Diffstat (limited to 'system/musl/0002-iconv-harden-UTF-8-output-code-path-against-input-de.patch')
-rw-r--r-- | system/musl/0002-iconv-harden-UTF-8-output-code-path-against-input-de.patch | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/system/musl/0002-iconv-harden-UTF-8-output-code-path-against-input-de.patch b/system/musl/0002-iconv-harden-UTF-8-output-code-path-against-input-de.patch new file mode 100644 index 000000000..d66e66e3f --- /dev/null +++ b/system/musl/0002-iconv-harden-UTF-8-output-code-path-against-input-de.patch @@ -0,0 +1,37 @@ +From c47ad25ea3b484e10326f933e927c0bc8cded3da Mon Sep 17 00:00:00 2001 +From: Rich Felker <dalias@aerifal.cx> +Date: Wed, 12 Feb 2025 17:06:30 -0500 +Subject: [PATCH] iconv: harden UTF-8 output code path against input decoder + bugs + +the UTF-8 output code was written assuming an invariant that iconv's +decoders only emit valid Unicode Scalar Values which wctomb can encode +successfully, thereby always returning a value between 1 and 4. + +if this invariant is not satisfied, wctomb returns (size_t)-1, and the +subsequent adjustments to the output buffer pointer and remaining +output byte count overflow, moving the output position backwards, +potentially past the beginning of the buffer, without storing any +bytes. +--- + src/locale/iconv.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/locale/iconv.c b/src/locale/iconv.c +index 008c93f0..52178950 100644 +--- a/src/locale/iconv.c ++++ b/src/locale/iconv.c +@@ -545,6 +545,10 @@ size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restri + if (*outb < k) goto toobig; + memcpy(*out, tmp, k); + } else k = wctomb_utf8(*out, c); ++ /* This failure condition should be unreachable, but ++ * is included to prevent decoder bugs from translating ++ * into advancement outside the output buffer range. */ ++ if (k>4) goto ilseq; + *out += k; + *outb -= k; + break; +-- +2.21.0 + |