Skip to content

Fix begin iterator for empty arrays.#15252

Merged
1 commit merged into
mainfrom
test_595198113
Jan 2, 2024
Merged

Fix begin iterator for empty arrays.#15252
1 commit merged into
mainfrom
test_595198113

Conversation

@copybara-service

Copy link
Copy Markdown

Fix begin iterator for empty arrays.

If the underlying array for a repeated field is a nullptr (which is possible for const array access on a message field that hasn't been set) the begin iterator will currently contain garbage data, which can lead to an illegal access. This CL adds a nullptr check to begin(), similar to what already exists for size().

If the underlying array for a repeated field is a nullptr (which is possible for const array access on a message field that hasn't been set) the begin iterator will currently contain garbage data, which can lead to an illegal access. This CL adds a nullptr check to `begin()`, similar to what already exists for `size()`.

PiperOrigin-RevId: 595217999
@copybara-service copybara-service Bot closed this pull request by merging all changes into main in 670e0c2 Jan 2, 2024
@copybara-service copybara-service Bot deleted the test_595198113 branch January 2, 2024 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant