jding-xyz commented on code in PR #152:
URL: https://github.com/apache/arrow-swift/pull/152#discussion_r3007623271
##########
Sources/Arrow/ArrowReader.swift:
##########
@@ -195,9 +195,19 @@ public class ArrowReader { // swiftlint:disable:this
type_body_length
let arrowNullBuffer = makeBuffer(nullBuffer, fileData:
loadInfo.fileData,
length: nullLength, messageOffset:
loadInfo.messageOffset)
let arrowOffsetBuffer = makeBuffer(offsetBuffer, fileData:
loadInfo.fileData,
- length: UInt(node.length),
messageOffset: loadInfo.messageOffset)
+ length: UInt(node.length + 1),
messageOffset: loadInfo.messageOffset)
+ let lastOffset = arrowOffsetBuffer.rawPointer
+ .advanced(by: Int(node.length) * MemoryLayout<Int32>.stride)
+ .load(as: Int32.self)
+ guard lastOffset >= 0 else {
+ return .failure(.invalid("Negative last offset (\(lastOffset)) in
variable-width buffer"))
+ }
+ guard lastOffset <= valueBuffer.length else {
Review Comment:
Good finding. Modified as suggested.
--
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]