Skip to content

Update to musl 1.2.5. #557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jun 3, 2025
Merged

Update to musl 1.2.5. #557

merged 14 commits into from
Jun 3, 2025

Conversation

sunfishcode
Copy link
Member

@sunfishcode sunfishcode commented Dec 11, 2024

See the WHATSNEW file for details.

See the WHATSNEW file for details.
Revert musl patches:
 - 246f1c811448f37a44b41cd8df8d0ef9736d95f4
 - 25e6fee27f4a293728dd15b659170e7b9c7db9bc
 - 7c41047285a24a97e700b4fb5b6b69f4505e2d82
 - 718f363bc2067b6487900eddc9180c84e7739f80

In upstream musl, these patches replace the explicit LFS64 symbols with
dynamic linker symbol lookups, which wasi-libc doesn't have. To preserve
compatibility with existing code using these symbols, revert these
patches in wasi-libc.
Backport another part of the revert of
25e6fee27f4a293728dd15b659170e7b9c7db9bc.
Apply the [first patch] to fix CVE-2025-26519:

>From e5adcd97b5196e29991b524237381a0202a60659 Mon Sep 17 00:00:00 2001
From: Rich Felker <[email protected]>
Date: Sun, 9 Feb 2025 10:07:19 -0500
Subject: [PATCH] iconv: fix erroneous input validation in EUC-KR decoder

as a result of incorrect bounds checking on the lead byte being
decoded, certain invalid inputs which should produce an encoding
error, such as "\xc8\x41", instead produced out-of-bounds loads from
the ksc table.

in a worst case, the loaded value may not be a valid unicode scalar
value, in which case, if the output encoding was UTF-8, wctomb would
return (size_t)-1, causing an overflow in the output pointer and
remaining buffer size which could clobber memory outside of the output
buffer.

bug report was submitted in private by Nick Wellnhofer on account of
potential security implications.

[first patch]: https://www.openwall.com/lists/musl/2025/02/13/1/1
Apply the [second patch] to fix CVE-2025-26519:

>From c47ad25ea3b484e10326f933e927c0bc8cded3da Mon Sep 17 00:00:00 2001
From: Rich Felker <[email protected]>
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.

[second patch]: https://www.openwall.com/lists/musl/2025/02/13/1/2
@sunfishcode sunfishcode merged commit 4720b34 into main Jun 3, 2025
18 checks passed
@sunfishcode sunfishcode deleted the sunfishcode/update-musl branch June 3, 2025 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant