Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Size computation for allocation may overflow #703

Closed
wants to merge 1 commit into from
Closed
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: 4 additions & 2 deletions log/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@

func newContext(prefix []interface{}, suffix []interface{}) []interface{} {
normalizedSuffix := normalize(suffix)
newCtx := make([]interface{}, len(prefix)+len(normalizedSuffix))
size := len(prefix) + len(normalizedSuffix)

Check failure

Code scanning / CodeQL

Size computation for allocation may overflow High

This operation, which is used in an
allocation
, involves a
potentially large value
and might overflow.
newCtx := make([]interface{}, size)
n := copy(newCtx, prefix)
copy(newCtx[n:], normalizedSuffix)
return newCtx
Expand Down Expand Up @@ -230,7 +231,8 @@
type Ctx map[string]interface{}

func (c Ctx) toArray() []interface{} {
arr := make([]interface{}, len(c)*2)
size := len(c) * 2

Check failure

Code scanning / CodeQL

Size computation for allocation may overflow High

This operation, which is used in an
allocation
, involves a
potentially large value
and might overflow.
arr := make([]interface{}, size)

i := 0
for k, v := range c {
Expand Down
Loading