mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 22:33:08 +00:00
musl: Apply Rich Felker's CVE-2025-26519 mitigation patches.
https://www.openwall.com/lists/oss-security/2025/02/13/2 Closes #22883.
This commit is contained in:
parent
462d26171b
commit
8a3aebaee0
6
lib/libc/musl/src/locale/iconv.c
vendored
6
lib/libc/musl/src/locale/iconv.c
vendored
@ -495,7 +495,7 @@ size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restri
|
|||||||
if (c >= 93 || d >= 94) {
|
if (c >= 93 || d >= 94) {
|
||||||
c += (0xa1-0x81);
|
c += (0xa1-0x81);
|
||||||
d += 0xa1;
|
d += 0xa1;
|
||||||
if (c >= 93 || c>=0xc6-0x81 && d>0x52)
|
if (c > 0xc6-0x81 || c==0xc6-0x81 && d>0x52)
|
||||||
goto ilseq;
|
goto ilseq;
|
||||||
if (d-'A'<26) d = d-'A';
|
if (d-'A'<26) d = d-'A';
|
||||||
else if (d-'a'<26) d = d-'a'+26;
|
else if (d-'a'<26) d = d-'a'+26;
|
||||||
@ -538,6 +538,10 @@ size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restri
|
|||||||
if (*outb < k) goto toobig;
|
if (*outb < k) goto toobig;
|
||||||
memcpy(*out, tmp, k);
|
memcpy(*out, tmp, k);
|
||||||
} else k = wctomb_utf8(*out, c);
|
} 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;
|
*out += k;
|
||||||
*outb -= k;
|
*outb -= k;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user