Repository navigation
fix(workbench): avoid narrowing uint32 conversion in log index lookups - #1182
Merged
Merged
Conversation
kyasbal
requested review from
K53,
RyuSA,
jyane,
kkuchima and
renamoo
as code owners
October 26, 2026 04:19
Contributor
There was a problem hiding this comment.
Code Review
This pull request prevents potential signed integer overflow issues when querying logs and timeline IDs with large uint32 values. Specifically, in GetLog and GetTimelineIDs, index bounds checks are updated to cast values to uint64 instead of int. Additionally, unit tests are added and updated to verify correct behavior with boundary values such as MaxInt32 + 1 and MaxUint32. I have no feedback to provide.
kyasbal
enabled auto-merge
October 26, 2026 04:22
Merged
via the queue into
GoogleCloudPlatform:main
with commit Oct 26, 2026
66d5a5d
17 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves the CodeQL
go/incorrect-integer-conversionsecurity alert introduced in #1177 when looking up workbench log entries by 1-baseduint32log IDs parsed from external tool inputs.Converting a
uint32log ID directly to signedintbefore bounds-checking against slice lengths (int(id) > len(...)andint(logID)+1 >= len(...)) narrows the unsigned 32-bit range on 32-bitintplatforms, allowing values abovemath.MaxInt32to wrap negative and bypass the upper-bound check. Performing the slice-length bounds comparisons inuint64width eliminates the narrowing conversion and prevents signed overflow.