Skip to content

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

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

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.

@raulcd

raulcd commented Jul 30, 2026

Copy link
Copy Markdown
Member

@KHARSHAVARDHAN-eng this is going to be my 4th attempt to interact with you. I'll start closing your PRs if you don't come back to us. Please act on feedback on your previous PRs before opening new ones.

@KHARSHAVARDHAN-eng

Copy link
Copy Markdown
Author

@raulcd , i will review all my prev pr and make changes in them.. Thanks !!!

@Reranko05

Copy link
Copy Markdown
Contributor

@KHARSHAVARDHAN-eng, This issue has been already assigned to someone, so pls work on the ones we have already given feedback on.

@raulcd raulcd closed this Jul 30, 2026
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.

3 participants