You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The identified bug is a panic in the Sway compiler's semantic analysis module, specifically in the root namespace processing. This occurs due to an unexpected None value being unwrapped, likely indicating a failure to properly handle certain code structures or declarations. If exploited in production, this bug could lead to compiler crashes, preventing developers from building their Fuel projects.
if type_decl.ty.clone() is None, it will cause unexpected unwrap panic like:
thread 'main' panicked at sway-core/src/semantic_analysis/namespace/root.rs:934:61:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Possible fix
A possible fix is checking whether type_decl.ty is None before return.
While this bug doesn't directly put funds at risk, its potential to introduce vulnerabilities and disrupt the development process makes it a severe issue. The compiler is a critical component of the blockchain development stack, and its reliability is paramount for the security and success of the entire ecosystem. Addressing this vulnerability is crucial to maintain the integrity and trustworthiness of the Fuel platform.
References
Add any relevant links to documentation or code
Proof of Concept
Step1
forc new poc
Step2
write minimized code to main.sw
script;trait T{type E const C:Self::E::E}
Step3
forc build
It return panic like:
thread 'main' panicked at sway-core/src/semantic_analysis/namespace/root.rs:934:61:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
The text was updated successfully, but these errors were encountered:
Doing an unwrap without checking if the value was none was causing a panic.
Fixed by throwing an error so we can also see the previous errors.
Fixes#6330
From https://bugs.immunefi.com/dashboard/submission/33171
Brief/Intro
The identified bug is a panic in the Sway compiler's semantic analysis module, specifically in the root namespace processing. This occurs due to an unexpected None value being unwrapped, likely indicating a failure to properly handle certain code structures or declarations. If exploited in production, this bug could lead to compiler crashes, preventing developers from building their Fuel projects.
Vulnerability Details
The bug is in decl_to_type_info at
sway/sway-core/src/semantic_analysis/namespace/root.rs
Line 934 in 28db326
if type_decl.ty.clone() is None, it will cause unexpected unwrap panic like:
Possible fix
A possible fix is checking whether type_decl.ty is None before return.
Impact Details
While this bug doesn't directly put funds at risk, its potential to introduce vulnerabilities and disrupt the development process makes it a severe issue. The compiler is a critical component of the blockchain development stack, and its reliability is paramount for the security and success of the entire ecosystem. Addressing this vulnerability is crucial to maintain the integrity and trustworthiness of the Fuel platform.
References
Add any relevant links to documentation or code
Proof of Concept
Step1
forc new poc
Step2
write minimized code to main.sw
Step3
forc build
It return panic like:
The text was updated successfully, but these errors were encountered: