chaokunyang commented on code in PR #3374:
URL: https://github.com/apache/fory/pull/3374#discussion_r2867107110


##########
go/fory/buffer.go:
##########
@@ -28,12 +29,76 @@ type ByteBuffer struct {
        data        []byte // Most accessed field first for cache locality
        writerIndex int
        readerIndex int
+       reader      io.Reader
+       minCap      int
 }
 
 func NewByteBuffer(data []byte) *ByteBuffer {
        return &ByteBuffer{data: data}
 }
 
+func NewByteBufferFromReader(r io.Reader, minCap int) *ByteBuffer {

Review Comment:
   This introduces stream mode, but `ByteBuffer.Read(p)` still only copies from 
in-memory `b.data` and never calls `fill`. Any decode path that uses `Read` can 
therefore observe partial/zero bytes with short-chunk readers. Please make 
stream-backed `Read` fetch until `len(p)` bytes are available (or return the 
underlying read error) to avoid silent metadata corruption.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to