Skip to content

Commit 9c0a9c4

Browse files
committed
ci:fix size computation for allocation may overflow
1 parent 4b122c7 commit 9c0a9c4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

common/log/log15/logger.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ func (l *logger) SetMaxLevel(maxLevel int) {
140140

141141
func newContext(prefix []interface{}, suffix []interface{}) []interface{} {
142142
normalizedSuffix := normalize(suffix)
143+
if len(normalizedSuffix) > 1e8 {
144+
panic("too many suffix")
145+
}
143146
newCtx := make([]interface{}, len(prefix)+len(normalizedSuffix))
144147
n := copy(newCtx, prefix)
145148
copy(newCtx[n:], normalizedSuffix)
@@ -217,8 +220,10 @@ type Lazy struct {
217220
type Ctx map[string]interface{}
218221

219222
func (c Ctx) toArray() []interface{} {
223+
if len(c) > 1e8 {
224+
panic("toArray too many arguments")
225+
}
220226
arr := make([]interface{}, len(c)*2)
221-
222227
i := 0
223228
for k, v := range c {
224229
arr[i] = k

0 commit comments

Comments
 (0)