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

feat(api): fix overflow in coreservice #4192

Merged
merged 1 commit into from
Mar 21, 2024
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
7 changes: 3 additions & 4 deletions api/coreservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -1318,10 +1318,9 @@
if reverseStart > size || count == 0 {
return nil
}
// TODO (saito): fix overflow
start := size - (reverseStart + count)
if start < 0 {
start = 0
start := uint64(0)
if size > reverseStart+count {
start = size - (reverseStart + count)

Check warning on line 1323 in api/coreservice.go

View check run for this annotation

Codecov / codecov/patch

api/coreservice.go#L1321-L1323

Added lines #L1321 - L1323 were not covered by tests
}
end := size - 1 - reverseStart
res := make([]*iotexapi.ActionInfo, 0, start-end+1)
Expand Down
Loading