dmitry-chirkov-dremio commented on code in PR #50463:
URL: https://github.com/apache/arrow/pull/50463#discussion_r3572598120


##########
cpp/src/gandiva/gdv_function_stubs_test.cc:
##########
@@ -1202,6 +1202,23 @@ TEST(TestGdvFnStubs, TestTranslate) {
   EXPECT_STREQ(result, "");
   EXPECT_THAT(ctx.get_error(),
               ::testing::HasSubstr("Would overflow maximum output size"));
+

Review Comment:
   Nice fix.
   
   I think the logic change is sound: moving the `from_for == from_len` check 
ahead of the read closes the one-byte over-read, and clamping invalid/truncated 
UTF-8 widths to 1 avoids both OOB reads and zero-width infinite loops. 
   
   The one thing still missing is a regression test for the to side, since this 
patch also changes `len_char_to` handling. Please add a case where `to` ends in 
a truncated or invalid multibyte lead byte so the third safety fix is covered 
too.



-- 
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]

Reply via email to