Skip to content

get_transactions bug, fail with Natural subtraction underflow #21

Description

@ic-dstar

If It has 3 transactions, call get_transactions fail with Natural subtraction underflow.
you can test it if set a length less than start (by search inside transactions).

// dfx call
call get_transactions '(record{start=2 : nat; length=1 : nat})'

the bug cause by this line.

txs_in_canister:= SB.slice(transactions, tx_start_index, req.length);

function SB.sclice accept argument (buffer, start, end)

StableBuffer with slice = func<A>(buffer : T.StableBuffer<A>, start : Nat, end : Nat) : [A] {

but the code call it , SB.slice(transactions, tx_start_index, req.length).

it should fix to


SB.slice(transactions, tx_start_index,  tx_start_index + req.length).

could you fix this? or may I pull a request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions