Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion contracts/remittance_nft/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,13 @@ impl RemittanceNFT {
return Vec::new(&env);
}
let mut page = Vec::new(&env);
let end = (offset + limit).min(len);
// `offset + limit` is not safe here: contract Wasm is built with
// `overflow-checks = true` (contracts/Cargo.toml), so any offset above
// zero combined with a large limit (e.g. offset = 1, limit = u32::MAX)
// traps the whole call. Saturate first, THEN clamp to `len`, so a
// saturated u32::MAX still resolves to the real available tail instead
// of being used as an oversized range bound.
let end = offset.saturating_add(limit).min(len);
for idx in offset..end {
page.push_back(history.get(idx).unwrap());
}
Expand Down
Loading