You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
LZ4FrameInputStream throws NullPointerException on streams that contain only skippable frames #103
skippableFrame() sets firstFrameHeaderRead = true (line 175), but buffer and frameInfo stay null. After a stream made only of skippable frames:
the first read() returns -1;
a second read(), skip() or available() then throws NullPointerException: Cannot invoke "java.nio.ByteBuffer.remaining()" because "this.buffer" is null (~328).
The same happens with readSingleFrame=true, and when getExpectedContentSize() / isExpectedContentSizeDefined() is called before read(). The shortest trigger is 8 bytes: a skippable magic plus size 0.
The existing testSkippableOnly calls read() only once, which is why it passes.
Fix: split the flag in two.
Add private boolean anyFrameRead; and use it in nextFrameInfo() for the "clean EOF vs premature end of stream" decision.
skippableFrame() sets anyFrameRead = true, and readHeader() sets both flags.
firstFrameHeaderRead then means "a real header has been read", so buffer and frameInfo are always non-null when it is true.
Extend testSkippableOnly with a second read() and an available() assertion.
Activity