Copilot commented on code in PR #528:
URL: https://github.com/apache/arrow-dotnet/pull/528#discussion_r4788660259
##########
src/Apache.Arrow/Arrays/StringArray.cs:
##########
@@ -143,14 +143,14 @@ public string GetString(int index, Encoding encoding =
default)
return string.Empty;
}
- ReadOnlySpan<byte> values = Values;
+ // Slice before taking a pointer, so that the offsets are checked
against the
+ // value buffer the same way GetBytes checks them.
+ ReadOnlySpan<byte> value = Values.Slice(valueOffset, valueLength);
Review Comment:
The new validation is still bypassed when both offsets are equal. For
example, offsets `{ 6, 6 }` (or `{ -1, -1 }`) with the five-byte buffer return
an empty string, while `GetBytes(0)` throws. Move the slice before the
zero-length fast path so empty values also receive the promised bounds
validation, and include these cases in the regression theory.
--
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]