Skip to content

Fix Icon(Stream) handling of partial reads#82621

Merged
stephentoub merged 2 commits into
dotnet:mainfrom
stephentoub:fixiconctor
Mar 2, 2023
Merged

Fix Icon(Stream) handling of partial reads#82621
stephentoub merged 2 commits into
dotnet:mainfrom
stephentoub:fixiconctor

Conversation

@stephentoub

Copy link
Copy Markdown
Member

Icon's ctor assumes Read on a stream will always produce as much data as was asked for, and that's not guaranteed to be the case.

Fixes #80261

Icon's ctor assumes Read on a stream will always produce as much data as was asked for, and that's not guaranteed to be the case.
@ghost

ghost commented Feb 24, 2023

Copy link
Copy Markdown

Tagging subscribers to this area: @dotnet/area-system-drawing
See info in area-owners.md if you want to be subscribed.

Issue Details

Icon's ctor assumes Read on a stream will always produce as much data as was asked for, and that's not guaranteed to be the case.

Fixes #80261

Author: stephentoub
Assignees: -
Labels:

area-System.Drawing

Milestone: -

@stephentoub stephentoub merged commit bac3bef into dotnet:main Mar 2, 2023
@stephentoub stephentoub deleted the fixiconctor branch March 2, 2023 17:04
stream.Read(_iconData, 0, _iconData.Length);
#if NET7_0_OR_GREATER
stream.ReadExactly(_iconData);
#else

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we want to backport this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't think so. It's been like this forever and to my knowledge no one has complained. I found it via an audit rather than feedback.

@ghost ghost locked as resolved and limited conversation to collaborators Apr 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Icon/Image from Stream doesn't work for partial reads

3 participants