Skip to content

shall we restrict the size of input in btcec.FieldVal.SetByteSlice(b []byte)?  #1170

Closed
@chaintechlab

Description

According to the comment, " Only the first 32-bytes are used. As a result, it is up to the caller to ensure numbers of the appropriate size are used or the value will be truncated."
However, in the code:

for i := 0; i < len(b); i++ {
       if i < 32 {
           b32[i+(32-len(b))] = b[i]
       }
   }

This will crash if len(b) > 32. Shall we add
b = b[:32]
?

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