Skip to content

fix: use std::map for field ID mapping in ForAllFields#9026

Closed
matejsmycka wants to merge 1 commit intogoogle:masterfrom
matejsmycka:fix-forallfields-oob-write
Closed

fix: use std::map for field ID mapping in ForAllFields#9026
matejsmycka wants to merge 1 commit intogoogle:masterfrom
matejsmycka:fix-forallfields-oob-write

Conversation

@matejsmycka
Copy link
Copy Markdown

Replace std::vector indexed by field->id() with std::map in ForAllFields and FieldIdToIndex to prevent OOB write when field IDs exceed field count in crafted .bfbs schemas.

@github-actions github-actions Bot added c++ codegen Involving generating code from schema labels Apr 6, 2026
@matejsmycka matejsmycka force-pushed the fix-forallfields-oob-write branch from 6ecad4d to d869797 Compare April 6, 2026 21:12
@matejsmycka matejsmycka changed the title fix: prevent heap-buffer-overflow in ForAllFields via unchecked field IDs fix: use std::map for field ID mapping in ForAllFields Apr 6, 2026
Replace std::vector indexed by field->id() with std::map in both
ForAllFields (reflection.cpp) and FieldIdToIndex (bfbs_gen.h).
@matejsmycka matejsmycka force-pushed the fix-forallfields-oob-write branch from d869797 to af958d9 Compare April 6, 2026 21:12
@matejsmycka matejsmycka closed this Apr 6, 2026
@matejsmycka matejsmycka deleted the fix-forallfields-oob-write branch April 6, 2026 21:12
@matejsmycka matejsmycka restored the fix-forallfields-oob-write branch April 6, 2026 21:14
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