Windows: fs calls abort the process on a path containing U+10FFFF (libuv assert, fixed in libuv 1.52.0 but not in v22/v25)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 58/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- javascript, node.js
- Lĩnh vực
- backend, operating-systems
Hướng nghiên cứu
Bắt đầu bằng cách chạy bản tái hiện fs trên Windows với String.fromCodePoint(0x10FFFF), sau đó kiểm tra deps/uv/src/idna.c và bài kiểm thử hồi quy được thêm bởi commit 73bfbb9 của libuv. Kiểm tra bản cập nhật libuv được tích hợp trong v22 hoặc đường dẫn backport, và xác minh rằng cùng lời gọi đó không còn abort nữa mà thay vào đó trả về hành vi lỗi hệ thống tệp thông thường.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version
v22.15.0 (also affects v22.23.2, v25.9.0, v20.x by bundled-libuv version)
Platform
Microsoft Windows NT 10.0.26200.0 x64
Subsystem
fs
What steps will reproduce the bug?
require('fs').existsSync(String.fromCodePoint(0x10FFFF))
Output:
Assertion failed: code_point < 0x10FFFF, file c:\ws\deps\uv\src\idna.c, line 397
Exit code 127. The process is aborted, not an exception.
statSync and readFileSync behave identically. It is not catchable:
try { require('fs').statSync(String.fromCodePoint(0x10FFFF)); }
catch (e) { console.log('caught:', e.code); }
console.log('reached end'); // never printed
Control — the neighbouring code point is handled correctly:
require('fs').existsSync(String.fromCodePoint(0x10FFFE)) // returns false
U+10FFFD is likewise fine. Only U+10FFFF, the maximum legal Unicode scalar value, aborts.
How often does it reproduce? Is there a required condition?
Every time, on Windows. The path need not exist — the abort happens during the UTF-8 → UTF-16 path conversion, before any filesystem access.
What is the expected behavior? Why is that the expected behavior?
ENOENT (or any throw), as with every other non-existent path. U+10FFFF is a valid Unicode scalar value and a legal character in a JS string, so it can arrive from any untrusted input that is used as a path.
The important part is not that it fails, but that it fails un-catchably. A library cannot defend itself with try/catch, so any code that stats or reads a caller-supplied path can have its process killed. That is a denial-of-service vector for anything that takes a path from user input, a config file, or a network request.
What do you see instead?
The process aborts with the libuv assertion above.
Additional information
This is already fixed in libuv, but the fix has not reached all Node release lines.
libuv commit 73bfbb9 — "idna: fix assert in wtf8_to_utf16 conversion" (libuv#5021, 2026-02-04) — corrects an off-by-one in uv_wtf8_to_utf16:
if (code_point > 0xFFFF) {
- assert(code_point < 0x10FFFF);
+ assert(code_point <= 0x10FFFF);
It also adds a regression test for exactly this input ("\xF4\x8F\xBF\xBF").
That fix first shipped in libuv v1.52.0 (2026-02-11). Bundled libuv by Node release line:
| line | latest | bundled libuv | affected |
|---|---|---|---|
| v26 | 26.7.0 | 1.52.1 | no |
| v25 | 25.9.0 | 1.51.0 | yes |
| v24 | 24.19.0 | 1.52.1 | no |
| v22 (LTS) | 22.23.2 | 1.51.0 | yes |
| v20 | 20.20.2 | 1.46.0 | yes |
So current v22 LTS is still affected, which is the reason for this report — v24 and v26 already carry the fix.
Reproduced directly on v22.15.0 (libuv 1.49.2). v22.23.2, v25.9.0 and v20.x are identified as affected from the bundled libuv version and the commit's release tag rather than executed on each line.
Would a libuv update (or a backport of this one-line change) to the v22 line be in scope? Happy to open the PR if that is the preferred route.
Found when a property-based test in a downstream project generated arbitrary strings and killed the test worker with no assertion output, roughly one run in five.
- Ngôn ngữ chính
- JavaScript
- Star
- 122k
- Fork
- 37.4k
- Merge trung bình
- 4 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 273
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của nodejs/node
-
doc
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
build
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
feature request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Issue tương tự
-
Edit: CW+ Đang mởchannels:edit check:passed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
스택 PR 머지 시 하위 PR base 재지정 단계 부재 Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
idean3885/claude-ops-agent#521 ·
-
[Nytt ikon]: menu-search Đang mởforespørsel 🥰 ikoner 🖼 nytt ✨
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
avniproject/avni-client#2135 ·
-
automated broken-link
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100