Arawoof06 commented on code in PR #50381:
URL: https://github.com/apache/arrow/pull/50381#discussion_r3527086735
##########
cpp/src/gandiva/precompiled/string_ops.cc:
##########
@@ -2487,6 +2487,13 @@ const char* byte_substr_binary_int32_int32(gdv_int64
context, const char* text,
startPos = text_len + offset;
}
+ // an offset past the end of the text leaves nothing to copy; without this
the
+ // truncation below yields a negative *out_len that memcpy reads as a huge
size
+ if (startPos >= text_len) {
+ *out_len = 0;
+ return "";
Review Comment:
Good catch. Moved the startPos computation and the past-end check above
gdv_fn_context_arena_malloc, so an offset beyond the text now returns empty
without allocating or touching the OOM path.
--
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]