Arawoof06 opened a new pull request, #1522:
URL: https://github.com/apache/arrow-java/pull/1522

   ## What's Changed
   
   `Text.validateUTF8Internal` walks the bytes with a lead-byte/trail-byte 
state machine, but when the loop runs out of input it returns success even if 
it is still waiting for trail bytes. A value that ends partway through a 
multi-byte sequence, such as `C3`, `E2 82` or `F0 9F 98`, is reported as valid 
UTF-8.
   
   That helper backs `validateScalars` in `VarCharVector`, `LargeVarCharVector` 
and `ViewVarCharVector`, so `ValueVectorUtility.validateFull` (and 
`ArrowReader` with `setValidateBatches(true)`, the option recommended for 
untrusted IPC input) accepts a Utf8 column holding invalid UTF-8. Lead bytes 
that are invalid on their own (`FF FE`) were already rejected, which is why the 
existing tests pass.
   
   The fix reports the end position as malformed when the input ends outside 
the lead-byte state. Valid input is unaffected. `testValidateTruncatedUTF8` in 
`TestValidateVectorFull` covers truncated 2, 3 and 4 byte sequences for VarChar 
and LargeVarChar. It fails without the change and passes with it, and the rest 
of the `vector` tests still pass.


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