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
6 changes: 5 additions & 1 deletion cbor/decode.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 Blink Labs Software
// Copyright 2025 Blink Labs Software
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -17,6 +17,7 @@ package cbor
import (
"bytes"
"fmt"
"math"
"reflect"
"sync"

Expand Down Expand Up @@ -68,6 +69,9 @@ func DecodeIdFromList(cborData []byte) (int, error) {
switch v := tmp.Value().([]interface{})[0].(type) {
// The upstream CBOR library uses uint64 by default for numeric values
case uint64:
if v > uint64(math.MaxInt) {
return 0, fmt.Errorf("decoded numeric value too large: uint64 > int")
}
return int(v), nil
default:
return 0, fmt.Errorf("first list item was not numeric, found: %v", v)
Expand Down
Loading