Arawoof06 commented on code in PR #50709:
URL: https://github.com/apache/arrow/pull/50709#discussion_r3776565361
##########
cpp/src/gandiva/gdv_function_stubs.cc:
##########
@@ -611,7 +611,7 @@ const char* gdv_mask_last_n_utf8_int32(int64_t context,
const char* data,
while (bytes_read < data_len) {
auto char_len =
utf8proc_iterate(reinterpret_cast<const utf8proc_uint8_t*>(data +
bytes_read),
- data_len, &utf8_char);
+ data_len - bytes_read, &utf8_char);
Review Comment:
Good point. The decompose pre-pass above already rejects invalid utf8 before
either loop runs, so char_len can't come back negative here, which is why the
check was missing. But it's cheap and keeps this consistent with the other
iterate sites, so I added the char_len < 0 guard at both call sites (600 and
614).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]