Skip to content

GH-50707: [C++][Gandiva] Fix out-of-bounds read in mask functions - #50733

Open
KHARSHAVARDHAN-eng wants to merge 1 commit into
apache:mainfrom
KHARSHAVARDHAN-eng:gh-50707-gandiva-mask-utf8proc-clean
Open

GH-50707: [C++][Gandiva] Fix out-of-bounds read in mask functions#50733
KHARSHAVARDHAN-eng wants to merge 1 commit into
apache:mainfrom
KHARSHAVARDHAN-eng:gh-50707-gandiva-mask-utf8proc-clean

Conversation

@KHARSHAVARDHAN-eng

@KHARSHAVARDHAN-eng KHARSHAVARDHAN-eng commented Jul 30, 2026

Copy link
Copy Markdown

What changes are included?

Fix out-of-bounds reads in Gandiva UTF-8 masking functions by passing the remaining buffer length to utf8proc_iterate() instead of the original string length after advancing the input pointer.

Also adds missing error handling for invalid UTF-8 sequences and regression tests covering truncated multi-byte UTF-8 inputs.

Why are these changes needed?

The previous implementation advanced the input pointer while continuing to pass the original buffer length to utf8proc_iterate(). This could allow reads beyond the remaining valid buffer.

Tests

  • Added regression tests for truncated 2-byte, 3-byte, and 4-byte UTF-8 sequences.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant