-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for malformed utf8 sequence #47
Conversation
_streamReader = new StreamReader(inputStream, encoding); | ||
_unreadStack = new Stack<int>(); | ||
remainingChars = inputStream.Length; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like not all implementations of Stream
will support Length
: https://docs.microsoft.com/en-us/dotnet/api/system.io.stream.length?view=netframework-4.8#System_IO_Stream_Length
Is there a way to implement this fix without using Stream.Length
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the pull request as we discussed.
If an implementation does not support Length
property, there won't be any check for short sequences.
Created issue #101 to keep track of this.
2d691d2
to
145a38b
Compare
Issue #36 :
Description of changes:
If
StreamReader.Read()
returns -1 while the stream still has bytes, an exception will be thrown as the stream cannot be parsed as a valid stream,