Arawoof06 opened a new issue, #50707:
URL: https://github.com/apache/arrow/issues/50707

   The Gandiva mask stubs walk a utf8 string with `utf8proc_iterate`, but pass 
the total `data_len` as the remaining-byte count instead of `data_len - 
bytes_read` even though the pointer has already advanced:
   
   - `gdv_mask_first_n_utf8_int32`
   - `gdv_mask_last_n_utf8_int32`
   - `mask_utf8_utf8_utf8_utf8`
   
   `utf8proc_iterate(str, strlen, ...)` reads up to `strlen` bytes from `str`. 
With `str = data + bytes_read` and `strlen = data_len`, a truncated trailing 
multi-byte glyph (for example a lead byte `0xF0` as the final byte of an 
exactly-sized value buffer) makes utf8proc read continuation bytes past `data + 
data_len`.
   
   This is reachable from `mask()` / `mask_first_n()` / `mask_last_n()` on 
untrusted string data whose value buffer is exactly sized. Passing the true 
remaining length lets utf8proc report the truncated glyph instead of 
over-reading.
   
   ### Component(s)
   
   C++, Gandiva


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