Reading from the output of CodedInputStream(Iterable<ByteBuffer>)
errors out if the input contains empty ByteBuffer
s
#17850
Labels
What version of protobuf and what language are you using?
Version: main/v3.25.1
Language: Java
What operating system (Linux, Windows, ...) and version?
macOS Sonoma and Linux (not sure about the version, but I don't think it's relevant to the bug)
What runtime / compiler are you using (e.g., python version or gcc version)
javac 21
What did you do?
Call an
CodedInputStream.from(Iterable<ByteBuffer>)
where the iterable contains emptyByteBuffer
s.Specifically, this came from a
Publisher
ofio.netty.buffer.ByteBuf
which was converted into anIterable<ByteBuffer>
throughio.netty.buffer.ByteBuf::nioBuffers
.What did you expect to see
Empty byte buffers are skipped.
What did you see instead?
OR
documenting that callers must filter out empty
ByteBuffer
s themselves (that is what we did).If skipping empty
ByteBuffer
s is considered an acceptable solution, I'd be happy to contribute with a PR. The following diff shows a tentative approach.The text was updated successfully, but these errors were encountered: