Skip to content

FIX: validate SneakyBits marker characters - #2554

Open
Sylvester Kaczmarek (sylvesterkaczmarek) wants to merge 2 commits into
microsoft:mainfrom
sylvesterkaczmarek:fix/sneaky-bits-char-validation
Open

FIX: validate SneakyBits marker characters#2554
Sylvester Kaczmarek (sylvesterkaczmarek) wants to merge 2 commits into
microsoft:mainfrom
sylvesterkaczmarek:fix/sneaky-bits-char-validation

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown

Description

SneakyBitsSmugglerConverter accepts custom zero_char and one_char marker strings, but encoding and decoding require each marker to be exactly one character and require the two markers to be distinct.

Multi-character markers are emitted as multiple code points and cannot round-trip reliably; they can also make _build_identifier() fail when it calls ord(). Identical markers make binary 0 and 1 indistinguishable and silently corrupt decoded output.

This change validates both invariants during initialization and raises a clear ValueError for invalid marker configuration.

Tests

Adds regression coverage for empty or multi-character markers and identical zero/one markers.

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