Skip to content
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

integer overflow in parser angle bracket handling #119497

Open
Noratrieb opened this issue Jan 1, 2024 · 0 comments
Open

integer overflow in parser angle bracket handling #119497

Noratrieb opened this issue Jan 1, 2024 · 0 comments
Labels
A-parser Area: The parsing of Rust source code to an AST C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-debug-assertions This issue requires a build of rustc or tooling with debug-assertions in some way T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Noratrieb
Copy link
Member

the parser uses a u16 to track angle brackets. This isn't exactly unreasonable, but not everyone writes reasonable code. Some people don't, and this makes the compiler sad. It should probably be a u32.

https://github.com/boltlabs-inc/dialectic/tree/0d545aceb4a204b4d412e8fcf877ff2a41e35c3b/dialectic-macro

I expected to see this happen: no integer overflow
Instead, this happened: integer overflow

https://crater-reports.s3.amazonaws.com/pr-119440-1/try%23fe8f664b41f030f307cfeb6cb8c3a1419292aeed/reg/dialectic-macro-0.1.0/log.txt

Meta

rustc --version --verbose:

roughly rustc 1.77.0-nightly (3cdd004e5 2023-12-29)
Backtrace

[INFO] [stderr] thread 'rustc' panicked at compiler/rustc_parse/src/parser/mod.rs:740:13:
[INFO] [stderr] attempt to add with overflow
[INFO] [stderr] stack backtrace:
[INFO] [stderr]    0:     0x7fc9fab8b946 - std::backtrace_rs::backtrace::libunwind::trace::h5f2f9ef1f20601b2
[INFO] [stderr]                                at /rustc/fe8f664b41f030f307cfeb6cb8c3a1419292aeed/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
[INFO] [stderr]    1:     0x7fc9fab8b946 - std::backtrace_rs::backtrace::trace_unsynchronized::h0afa123c60ac3544
[INFO] [stderr]                                at /rustc/fe8f664b41f030f307cfeb6cb8c3a1419292aeed/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
[INFO] [stderr]    2:     0x7fc9fab8b946 - std::sys_common::backtrace::_print_fmt::h6bf637b081885c8e
[INFO] [stderr]                                at /rustc/fe8f664b41f030f307cfeb6cb8c3a1419292aeed/library/std/src/sys_common/backtrace.rs:68:5
[INFO] [stderr]    3:     0x7fc9fab8b946 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2c6761a2e200c979
[INFO] [stderr]                                at /rustc/fe8f664b41f030f307cfeb6cb8c3a1419292aeed/library/std/src/sys_common/backtrace.rs:44:22
[INFO] [stderr]    4:     0x7fc9fabde060 - core::fmt::rt::Argument::fmt::h16857210251b8080
[INFO] [stderr]                                at /rustc/fe8f664b41f030f307cfeb6cb8c3a1419292aeed/library/core/src/fmt/rt.rs:142:9
[INFO] [stderr]    5:     0x7fc9fabde060 - core::fmt::write::h15e31c36c28ee02f
[INFO] [stderr]                                at /rustc/fe8f664b41f030f307cfeb6cb8c3a1419292aeed/library/core/src/fmt/mod.rs:1120:17
[INFO] [stderr]    6:     0x7fc9fab7f2df - std::io::Write::write_fmt::h30eda9caba94b19c
[INFO] [stderr]                                at /rustc/fe8f664b41f030f307cfeb6cb8c3a1419292aeed/library/std/src/io/mod.rs:1810:15
[INFO] [stderr]    7:     0x7fc9fab8b724 - std::sys_common::backtrace::_print::h83083a5d53637ec4
[INFO] [stderr]                                at /rustc/fe8f664b41f030f307cfeb6cb8c3a1419292aeed/library/std/src/sys_common/backtrace.rs:47:5
[INFO] [stderr]    8:     0x7fc9fab8b724 - std::sys_common::backtrace::print::hc98591726bef92fd
[INFO] [stderr]                                at /rustc/fe8f664b41f030f307cfeb6cb8c3a1419292aeed/library/std/src/sys_common/backtrace.rs:34:9
[INFO] [stderr]    9:     0x7fc9fab8e4b7 - std::panicking::default_hook::{{closure}}::hc8badbdd77cc4572
[INFO] [stderr]   10:     0x7fc9fab8e219 - std::panicking::default_hook::ha24461576e8ae120
[INFO] [stderr]                                at /rustc/fe8f664b41f030f307cfeb6cb8c3a1419292aeed/library/std/src/panicking.rs:292:9
[INFO] [stderr]   11:     0x7fc9fdaa28ac - std[9f4ae9e9cff43acb]::panicking::update_hook::<alloc[acd61960e0df7531]::boxed::Box<rustc_driver_impl[d22198136dec6837]::install_ice_hook::{closure#0}>>::{closure#0}
[INFO] [stderr]   12:     0x7fc9fab8ec06 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h55151e58e7322d9e
[INFO] [stderr]                                at /rustc/fe8f664b41f030f307cfeb6cb8c3a1419292aeed/library/alloc/src/boxed.rs:2029:9
[INFO] [stderr]   13:     0x7fc9fab8ec06 - std::panicking::rust_panic_with_hook::hed55d523c6a2382e
[INFO] [stderr]                                at /rustc/fe8f664b41f030f307cfeb6cb8c3a1419292aeed/library/std/src/panicking.rs:783:13
[INFO] [stderr]   14:     0x7fc9fab8e919 - std::panicking::begin_panic_handler::{{closure}}::h944452fa41308f37
[INFO] [stderr]                                at /rustc/fe8f664b41f030f307cfeb6cb8c3a1419292aeed/library/std/src/panicking.rs:649:13
[INFO] [stderr]   15:     0x7fc9fab8be46 - std::sys_common::backtrace::__rust_end_short_backtrace::h91d397e41fb21da0
[INFO] [stderr]                                at /rustc/fe8f664b41f030f307cfeb6cb8c3a1419292aeed/library/std/src/sys_common/backtrace.rs:171:18
[INFO] [stderr]   16:     0x7fc9fab8e6b0 - rust_begin_unwind
[INFO] [stderr]                                at /rustc/fe8f664b41f030f307cfeb6cb8c3a1419292aeed/library/std/src/panicking.rs:645:5
[INFO] [stderr]   17:     0x7fc9fabda765 - core::panicking::panic_fmt::he0a5a6033f24be27
[INFO] [stderr]                                at /rustc/fe8f664b41f030f307cfeb6cb8c3a1419292aeed/library/core/src/panicking.rs:72:14
[INFO] [stderr]   18:     0x7fc9fabda823 - core::panicking::panic::hc85da36c3a268157
[INFO] [stderr]                                at /rustc/fe8f664b41f030f307cfeb6cb8c3a1419292aeed/library/core/src/panicking.rs:144:5
[INFO] [stderr]   19:     0x7fc9ff34c9ac - <rustc_parse[951bc98562c6db9b]::parser::Parser>::eat_lt
[INFO] [stderr]   20:     0x7fc9ff25d7c5 - <rustc_parse[951bc98562c6db9b]::parser::Parser>::parse_path_inner
[INFO] [stderr]   21:     0x7fc9ff4c65c2 - <rustc_parse[951bc98562c6db9b]::parser::Parser>::parse_ty_common
[INFO] [stderr]   22:     0x7fc9ff351a03 - <rustc_parse[951bc98562c6db9b]::parser::Parser>::parse_angle_args
[INFO] [stderr]   23:     0x7fc9ff25d81e - <rustc_parse[951bc98562c6db9b]::parser::Parser>::parse_path_inner
<snip snip snip>

@Noratrieb Noratrieb added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-parser Area: The parsing of Rust source code to an AST T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. requires-debug-assertions This issue requires a build of rustc or tooling with debug-assertions in some way labels Jan 1, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 1, 2024
@Noratrieb Noratrieb removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-parser Area: The parsing of Rust source code to an AST C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-debug-assertions This issue requires a build of rustc or tooling with debug-assertions in some way T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants