Skip to content

bug: FeeHistory block number overflow — uint64 cast to int64 without range check #1038

@Aboudjem

Description

@Aboudjem

Bug Description

In rpc/backend/chain_info.go, FeeHistory casts block numbers to int64 without range checks:

blockNumber := int64(blkNumber) //#nosec G115
blockEnd := int64(lastBlock)    //#nosec G115

When blkNumber exceeds math.MaxInt64, the cast wraps to a negative value.

Impact

Block numbers > MaxInt64 produce incorrect negative values, potentially returning wrong fee history data.

Proposed Fix

Add range check before the cast: return error if value exceeds int64 range.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions