Skip to content

HBASE-30304 Prevent Bytes.toBytesBinary from throwing on truncated \x escape - #8508

Merged
junegunn merged 1 commit into
apache:masterfrom
junegunn:HBASE-30304
Jul 30, 2026
Merged

HBASE-30304 Prevent Bytes.toBytesBinary from throwing on truncated \x escape#8508
junegunn merged 1 commit into
apache:masterfrom
junegunn:HBASE-30304

Conversation

@junegunn

Copy link
Copy Markdown
Member

… escape

The \xNN parser guards only that the 'x' after a backslash exists, then
reads the two hex digits at i+2 and i+3 unconditionally. A string ending
in "\x" or "\x0" throws.

Widen the guard to require both hex digits in bounds. A truncated tail
escape now falls through to the existing bogus-escape path and emits the
backslash literally.

HBASE-6518 fixed the trailing bare-backslash case with the same guard but
did not extend it to the hex digits.
@junegunn
junegunn merged commit 3b378d7 into apache:master Jul 30, 2026
8 checks passed
@junegunn

Copy link
Copy Markdown
Member Author

@liuxiaocs7 Thanks for the review!

@junegunn junegunn self-assigned this Jul 30, 2026
junegunn added a commit that referenced this pull request Jul 30, 2026
… escape (#8508)

The \xNN parser guards only that the 'x' after a backslash exists, then
reads the two hex digits at i+2 and i+3 unconditionally. A string ending
in "\x" or "\x0" throws.

Widen the guard to require both hex digits in bounds. A truncated tail
escape now falls through to the existing bogus-escape path and emits the
backslash literally.

HBASE-6518 fixed the trailing bare-backslash case with the same guard but
did not extend it to the hex digits.

Signed-off-by: Xiao Liu <liuxiaocs@apache.org>
junegunn added a commit that referenced this pull request Jul 30, 2026
… escape (#8508)

The \xNN parser guards only that the 'x' after a backslash exists, then
reads the two hex digits at i+2 and i+3 unconditionally. A string ending
in "\x" or "\x0" throws.

Widen the guard to require both hex digits in bounds. A truncated tail
escape now falls through to the existing bogus-escape path and emits the
backslash literally.

HBASE-6518 fixed the trailing bare-backslash case with the same guard but
did not extend it to the hex digits.

Signed-off-by: Xiao Liu <liuxiaocs@apache.org>
junegunn added a commit that referenced this pull request Jul 30, 2026
… escape (#8508)

The \xNN parser guards only that the 'x' after a backslash exists, then
reads the two hex digits at i+2 and i+3 unconditionally. A string ending
in "\x" or "\x0" throws.

Widen the guard to require both hex digits in bounds. A truncated tail
escape now falls through to the existing bogus-escape path and emits the
backslash literally.

HBASE-6518 fixed the trailing bare-backslash case with the same guard but
did not extend it to the hex digits.

Signed-off-by: Xiao Liu <liuxiaocs@apache.org>
junegunn added a commit that referenced this pull request Jul 30, 2026
… escape (#8508)

The \xNN parser guards only that the 'x' after a backslash exists, then
reads the two hex digits at i+2 and i+3 unconditionally. A string ending
in "\x" or "\x0" throws.

Widen the guard to require both hex digits in bounds. A truncated tail
escape now falls through to the existing bogus-escape path and emits the
backslash literally.

HBASE-6518 fixed the trailing bare-backslash case with the same guard but
did not extend it to the hex digits.

Signed-off-by: Xiao Liu <liuxiaocs@apache.org>
junegunn added a commit that referenced this pull request Jul 30, 2026
… escape (#8508)

The \xNN parser guards only that the 'x' after a backslash exists, then
reads the two hex digits at i+2 and i+3 unconditionally. A string ending
in "\x" or "\x0" throws.

Widen the guard to require both hex digits in bounds. A truncated tail
escape now falls through to the existing bogus-escape path and emits the
backslash literally.

HBASE-6518 fixed the trailing bare-backslash case with the same guard but
did not extend it to the hex digits.

Signed-off-by: Xiao Liu <liuxiaocs@apache.org>
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.

2 participants