File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 1
- // Copyright 2024 Blink Labs Software
1
+ // Copyright 2025 Blink Labs Software
2
2
//
3
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
4
// you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@ package cbor
17
17
import (
18
18
"bytes"
19
19
"fmt"
20
+ "math"
20
21
"reflect"
21
22
"sync"
22
23
@@ -68,6 +69,9 @@ func DecodeIdFromList(cborData []byte) (int, error) {
68
69
switch v := tmp .Value ().([]interface {})[0 ].(type ) {
69
70
// The upstream CBOR library uses uint64 by default for numeric values
70
71
case uint64 :
72
+ if v > uint64 (math .MaxInt ) {
73
+ return 0 , fmt .Errorf ("decoded numeric value too large: uint64 > int" )
74
+ }
71
75
return int (v ), nil
72
76
default :
73
77
return 0 , fmt .Errorf ("first list item was not numeric, found: %v" , v )
You can’t perform that action at this time.
0 commit comments