Skip to content

Fix name compressors emitting wrong pointers past 14-bit offset limit - #707

Open
SebastiaanYN wants to merge 1 commit into
NLnetLabs:mainfrom
SebastiaanYN:compressor
Open

Fix name compressors emitting wrong pointers past 14-bit offset limit#707
SebastiaanYN wants to merge 1 commit into
NLnetLabs:mainfrom
SebastiaanYN:compressor

Conversation

@SebastiaanYN

Copy link
Copy Markdown
Contributor

All three compressors used 0xC000 (16 bits) as the maximum position for storing name offsets. The correct limit is 0x4000 (14 bits), because the top 2 bits of a compression pointer are the 0xC0 marker. Positions between 0x4000 and 0xBFFF produced pointers that decode to the wrong offset, corrupting owner names.

Introduce MAX_COMPRESSION_OFFSET (1 << 14) and use it in all insert and truncate methods of StaticCompressor, TreeCompressor, and HashCompressor.

All three compressors used `0xC000` (16 bits) as the maximum position
for storing name offsets. The correct limit is `0x4000` (14 bits),
because the top 2 bits of a compression pointer are the `0xC0` marker.
Positions between 0x4000 and 0xBFFF produced pointers that decode to
the wrong offset, corrupting owner names.

Introduce `MAX_COMPRESSION_OFFSET` (`1 << 14`) and use it in all
insert and truncate methods of `StaticCompressor`, `TreeCompressor`,
and `HashCompressor`.
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