Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Fix BinaryReader.ReadChars for fragmented Streams #26324

Merged
merged 2 commits into from
Aug 24, 2019

Conversation

jkotas
Copy link
Member

@jkotas jkotas commented Aug 22, 2019

BinaryReader.ReadChars incorrectly read more than necessary from the underlying Stream when multi-byte characters straddled the read chunks.

Fixes https://github.com/dotnet/corefx/issues/40455

@jkotas jkotas requested a review from carlossanlop August 22, 2019 22:11
@@ -217,7 +217,7 @@ public override unsafe int GetCharCount(byte* bytes, int count, bool flush)
public bool MustFlush => _mustFlush;

// Anything left in our decoder?
internal virtual bool HasState => false;
internal virtual bool HasState => _leftoverByteCount != 0;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GrabYourPitchforks Could you please review this part of the fix?

@jkotas
Copy link
Member Author

jkotas commented Aug 22, 2019

PR with CoreFX test will follow...

BinaryReader.ReadChars incorrectly read more than necessary from the underlying Stream when multi-byte characters straddled the read chunks.

Fixes https://github.com/dotnet/corefx/issues/40455
@jkotas jkotas merged commit 4e8339f into dotnet:master Aug 24, 2019
jkotas added a commit to jkotas/coreclr that referenced this pull request Aug 24, 2019
…et#26324)

BinaryReader.ReadChars incorrectly read more than necessary from the underlying Stream when multi-byte characters straddled the read chunks.

Fixes https://github.com/dotnet/corefx/issues/40455
Dotnet-GitSync-Bot pushed a commit to Dotnet-GitSync-Bot/corefx that referenced this pull request Aug 25, 2019
BinaryReader.ReadChars incorrectly read more than necessary from the underlying Stream when multi-byte characters straddled the read chunks.

Fixes https://github.com/dotnet/corefx/issues/40455

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Dotnet-GitSync-Bot pushed a commit to Dotnet-GitSync-Bot/corert that referenced this pull request Aug 25, 2019
BinaryReader.ReadChars incorrectly read more than necessary from the underlying Stream when multi-byte characters straddled the read chunks.

Fixes https://github.com/dotnet/corefx/issues/40455

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Dotnet-GitSync-Bot pushed a commit to Dotnet-GitSync-Bot/mono that referenced this pull request Aug 25, 2019
BinaryReader.ReadChars incorrectly read more than necessary from the underlying Stream when multi-byte characters straddled the read chunks.

Fixes https://github.com/dotnet/corefx/issues/40455

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
stephentoub pushed a commit to dotnet/corert that referenced this pull request Aug 26, 2019
BinaryReader.ReadChars incorrectly read more than necessary from the underlying Stream when multi-byte characters straddled the read chunks.

Fixes https://github.com/dotnet/corefx/issues/40455

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
stephentoub pushed a commit to dotnet/corefx that referenced this pull request Aug 26, 2019
BinaryReader.ReadChars incorrectly read more than necessary from the underlying Stream when multi-byte characters straddled the read chunks.

Fixes https://github.com/dotnet/corefx/issues/40455

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
akoeplinger pushed a commit to mono/mono that referenced this pull request Aug 26, 2019
BinaryReader.ReadChars incorrectly read more than necessary from the underlying Stream when multi-byte characters straddled the read chunks.

Fixes https://github.com/dotnet/corefx/issues/40455

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
jkotas added a commit that referenced this pull request Aug 26, 2019
…) (#26356)

BinaryReader.ReadChars incorrectly read more than necessary from the underlying Stream when multi-byte characters straddled the read chunks.

Fixes https://github.com/dotnet/corefx/issues/40455
@jkotas jkotas deleted the corefx-40455 branch August 26, 2019 15:24
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
BinaryReader.ReadChars incorrectly read more than necessary from the underlying Stream when multi-byte characters straddled the read chunks.

Fixes https://github.com/dotnet/corefx/issues/40455


Commit migrated from dotnet/coreclr@4e8339f
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Data corruption in BinaryReader.ReadChars
2 participants