You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by qu...@apache.org on 2022/11/02 21:45:25 UTC
[arrow-julia] branch main updated: fix BatchIterator iterate method to handle partial messages (#356)
This is an automated email from the ASF dual-hosted git repository.
quinnj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-julia.git
The following commit(s) were added to refs/heads/main by this push:
new d45c606 fix BatchIterator iterate method to handle partial messages (#356)
d45c606 is described below
commit d45c6063d74ccf461c53b19c1d83108736289e00
Author: Ben Baumgold <49...@users.noreply.github.com>
AuthorDate: Wed Nov 2 17:45:20 2022 -0400
fix BatchIterator iterate method to handle partial messages (#356)
Co-authored-by: Ben Baumgold <be...@mavensecurities.com>
---
src/table.jl | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/table.jl b/src/table.jl
index 7b6d8c8..70da986 100644
--- a/src/table.jl
+++ b/src/table.jl
@@ -418,10 +418,18 @@ function Base.iterate(x::BatchIterator, (pos, id)=(x.startpos, 0))
return nothing
end
pos += 4
+ if pos + msglen - 1 > length(x.bytes)
+ @debug 1 "not enough bytes left to read Meta.Message"
+ return nothing
+ end
msg = FlatBuffers.getrootas(Meta.Message, x.bytes, pos-1)
pos += msglen
# pos now points to message body
@debug 1 "parsing message: pos = $pos, msglen = $msglen, bodyLength = $(msg.bodyLength)"
+ if pos + msg.bodyLength - 1 > length(x.bytes)
+ @debug 1 "not enough bytes left to read message body"
+ return nothing
+ end
return Batch(msg, x.bytes, pos, id), (pos + msg.bodyLength, id + 1)
end