Skip to content

Handle empty and truncated buffers in ExtendedUnixData.SetData - #907

Open
seragAhmed wants to merge 1 commit into
icsharpcode:masterfrom
seragAhmed:fix/887-extended-unix-data-empty
Open

seragAhmed wants to merge 1 commit into
icsharpcode:masterfrom
seragAhmed:fix/887-extended-unix-data-empty

Conversation

@seragAhmed

Copy link
Copy Markdown

In ExtendedUnixData.SetData, calling ms.ReadByte() when count == 0 returned -1, which cast to (Flags)0xFF and caused ms.ReadLEInt() to throw EndOfStreamException.

This returns early when ReadByte() reaches EOF (-1) and checks that at least 4 bytes remain before reading each Unix timestamp (which also guards truncated central-header UT extra fields where access/create flag bits are set without accompanying timestamps).

Fixes #887.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected crashes in SetData method of ExtendedUnixData

2 participants