console.log/info/warn/error/debug silently truncate the line at an embedded NUL (U+0000)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 82/100
Hướng nghiên cứu
Bắt đầu với builtins/web/console.cpp và theo dõi cách console_out chuyển dòng đã định dạng đến builtin_impl_console_log; sau đó kiểm tra các phương thức console khác và phần ghi đè của ComponentizeJS trong embedding/embedding.cpp. Giữ nguyên toàn bộ chuỗi, bao gồm cả các NUL được nhúng, xuyên suốt hook và đường xuất dữ liệu. Xác nhận rằng bản tái hiện in ra toàn bộ nội dung sau NUL cho từng phương thức bị ảnh hưởng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
If any argument to a console method contains U+0000, everything after it on that line is lost, including later
arguments. No error is raised. JS strings may contain U+0000 (for example, output from TextDecoder, binary
protocols or String.fromCharCode loops), so debug output silently drops data.
Environment
- StarlingMonkey v0.4.0 release
starling.wasm, wasmtime 50.0.1,--legacy-script. - The code involved is unchanged on
main(54b3329b). - Also seen in a
@bytecodealliance/componentize-js0.23.0 component. - Checked on 2026-11-03. Reference: node v26.13.0.
Reproduction
console.log("a\u0000b", "c");
console.log("x", "a\u0000b", "c");
console.error(["a\u0000b"]);
console.log("next line is fine");
| StarlingMonkey | node | |
|---|---|---|
| line 1 | Log: a |
a\0b c |
| line 2 | Log: x a |
x a\0b c |
| line 3 | Error: [ "a |
[ 'a\x00b' ] |
| line 4 | Log: next line is fine |
next line is fine |
Expected
The whole line is printed (with the NUL written as-is or escaped). The Console Standard
leaves the output format to the implementation, but nothing allows dropping part of the data.
Cause
console_out in builtins/web/console.cpp builds the complete line in a std::string (NULs included), then calls
builtin_impl_console_log(log_ty, fullLogLine.c_str());
and builtin_impl_console_log(Console::LogType, const char *msg) prints msg as a C string, which stops at the first
'\0'. The other console methods (assert, count, time*, group, trace) pass .c_str() the same way.
Suggested fix
Change the hook to take a length-carrying string, e.g. builtin_impl_console_log(Console::LogType, std::string_view msg),
and print it with std::println(stdout, "{}: {}", prefix, msg) (a string_view argument keeps embedded NULs) or
fwrite(msg.data(), 1, msg.size(), stdout). Since builtin_impl_console_log is a weak symbol that embedders override,
ComponentizeJS's override in embedding/embedding.cpp (which prints with fprintf(stdout, "%s\n", msg)) needs the same
signature change.
- Ngôn ngữ chính
- C
- Star
- 297
- Fork
- 64
- Merge trung bình
- 1 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 16
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 bytecodealliance/StarlingMonkey
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
bytecodealliance/StarlingMonkey#355 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
CryptoKey class should use Finalizable class policyCó thể đã có người làm @andreiltd đã nhận 3 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
bytecodealliance/StarlingMonkey#343 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 68/100
bytecodealliance/StarlingMonkey#358 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
bytecodealliance/StarlingMonkey#357 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
bytecodealliance/StarlingMonkey#356 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của bytecodealliance/StarlingMonkey
Issue tương tự
-
area/docs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 83/100
Clodmony/starship-coop#72 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ospf6d: heap-use-after-free in seqnumber_mismatch()/bad_lsreq() when a neighbor is deleted with events pendingCó thể đã có người làm @lichenlang89 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 61/100
Maintainer thường phản hồi trong vòng 2 ngày
-
5700模组网络优先级问题Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
severity: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
luainkernel/lunatik#2372 ·
Maintainer thường phản hồi trong vòng 1 ngày