Attackathon _ Fuel Network 32728 - [Smart Contract - Low] Incorrect literal type inference
Description
Brief/Intro
Vulnerability Details
let (val, new_integer_type) = match lit {
Literal::Numeric(num) => match &*type_engine.get(new_type) {
TypeInfo::UnsignedInteger(n) => match n {
IntegerBits::Eight => (
...
),
IntegerBits::Sixteen => (
...
),
IntegerBits::ThirtyTwo => (
...
),
IntegerBits::SixtyFour => (
...
),
// Numerics are limited to u64 for now
IntegerBits::V256 => (Ok(Literal::U256(U256::from(num))), new_type),
},
TypeInfo::Numeric => (
num.to_string().parse().map(Literal::Numeric).map_err(|e| {
Literal::handle_parse_int_error(engines, e, TypeInfo::Numeric, span.clone())
}),
type_engine.insert(engines, TypeInfo::Numeric, None),
),
_ => unreachable!("Unexpected type for integer literals"),
},
_ => unreachable!("Unexpected non-integer literals"),
};Impact Details
References
Proof of concept
Proof of Concept
PreviousAttackathon _ Fuel Network 32706 - [Smart Contract - High] the function subtract in signed libs likeNextAttackathon _ Fuel Network 32730 - [Smart Contract - Low] The Sway compiler currently disallows read
Last updated
Was this helpful?