CurtHagenlocher commented on code in PR #528:
URL: https://github.com/apache/arrow-dotnet/pull/528#discussion_r4788746853


##########
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:
   Good catch, thanks. Fixed in 4aebeda: the slice now happens before the 
empty-value fast path, so equal offsets outside the buffer throw just as 
`GetBytes` does. `{ 6, 6 }` and `{ -1, -1 }` are now part of 
`ChecksOffsetsLikeGetBytes`.



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