Skip to content
Draft
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
12 changes: 10 additions & 2 deletions internal/scraper/modified.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,16 @@
}
oldMap := mapRawByID(oldPage.Results)

ids := make([]int64, 0, len(oldMap)+len(newMap))
seen := make(map[int64]struct{}, len(oldMap)+len(newMap))
oldLen := len(oldMap)
newLen := len(newMap)
maxInt := int(^uint(0) >> 1)
if oldLen > maxInt-newLen {
return nil, fmt.Errorf("too many tracked items")
}
total := oldLen + newLen

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.
This operation, which is used in an
allocation
, involves a
potentially large value
and might overflow.
This operation, which is used in an
allocation
, involves a
potentially large value
and might overflow.
This operation, which is used in an
allocation
, involves a
potentially large value
and might overflow.
This operation, which is used in an
allocation
, involves a
potentially large value
and might overflow.
This operation, which is used in an
allocation
, involves a
potentially large value
and might overflow.

ids := make([]int64, 0, total)
seen := make(map[int64]struct{}, total)
for id := range oldMap {
seen[id] = struct{}{}
ids = append(ids, id)
Expand Down