Skip to content

MINOR: [C++][Gandiva] cast to unsigned char before ctype calls#50124

Open
metsw24-max wants to merge 1 commit into
apache:mainfrom
metsw24-max:gandiva-ctype-unsigned-char
Open

MINOR: [C++][Gandiva] cast to unsigned char before ctype calls#50124
metsw24-max wants to merge 1 commit into
apache:mainfrom
metsw24-max:gandiva-ctype-unsigned-char

Conversation

@metsw24-max
Copy link
Copy Markdown
Contributor

Out-of-range argument passed to ctype functions

The Gandiva string and time helpers feed raw char bytes into isdigit/isxdigit/isalpha/toupper. Where char is signed, any byte above 0x7f (so any multi-byte UTF-8 value in untrusted column data) is sign-extended to a negative int, which sits outside the unsigned char/EOF domain those functions are defined for. glibc tolerates it, but a strict ctype table indexes before its lookup array. Cast each argument to unsigned char at the call site, the way gdv_function_stubs.cc already does. Reviewer note: this is the same swept across both files so no instance is left behind.

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