Skip to content

Guard PacketFieldHandle index against uint16_t overflow - #124

Open
abhyuday-fr wants to merge 1 commit into
google:mainfrom
abhyuday-fr:fix/packet-field-handle-overflow
Open

Guard PacketFieldHandle index against uint16_t overflow#124
abhyuday-fr wants to merge 1 commit into
google:mainfrom
abhyuday-fr:fix/packet-field-handle-overflow

Conversation

@abhyuday-fr

Copy link
Copy Markdown

PacketFieldHandle packs its index into 16 bits, but GetOrCreatePacketFieldHandle had no check that field_names_.size() still fits, so interning more than 2^16 distinct field names would silently truncate the index and alias two different field names onto the same handle. Add an explicit CHECK and a regression test.

Fixes #123

PacketFieldHandle packs its index into 16 bits, but
GetOrCreatePacketFieldHandle had no check that field_names_.size()
still fits, so interning more than 2^16 distinct field names would
silently truncate the index and alias two different field names onto
the same handle. Add an explicit CHECK and a regression test.

Fixes google#123
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.

PacketFieldManager::GetOrCreatePacketFieldHandle silently truncates index past 2^16 fields

1 participant