Skip to content

Add null check for type_vec in VerifyVector function#8996

Open
metsw24-max wants to merge 1 commit intogoogle:masterfrom
metsw24-max:reflection-union-typevec-null-deref
Open

Add null check for type_vec in VerifyVector function#8996
metsw24-max wants to merge 1 commit intogoogle:masterfrom
metsw24-max:reflection-union-typevec-null-deref

Conversation

@metsw24-max
Copy link
Copy Markdown

In VerifyVector, when handling reflection::Union vectors, type_vec could be null if the type vector field is absent in a malformed buffer. The existing v.VerifyVector(type_vec) call does not catch this — it returns true for null vectors by design. Execution then falls through to type_vec->size(), causing a null pointer dereference.

Added an explicit null check before the size comparison to return false early on malformed input, consistent with how the verifier handles other invalid states.

@github-actions github-actions bot added c++ codegen Involving generating code from schema labels Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ codegen Involving generating code from schema

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant