Skip to content

Commit 7ba89c1

Browse files
authored
[UIKit] Fix inexact stream read in UIImage. (#21916)
Fixes this analyzer warning: error CA2022: Avoid inexact read with 'System.IO.Stream.Read(byte[], int, int)' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2022)
1 parent 1e11836 commit 7ba89c1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/UIKit/UIImage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public UIImage Scale (CGSize newSize)
102102
throw new ArgumentException (String.Format ("No resource named `{0}' found", name));
103103

104104
byte [] buffer = new byte [stream.Length];
105-
stream.Read (buffer, 0, buffer.Length);
105+
stream.ReadExactly (buffer, 0, buffer.Length);
106106
unsafe {
107107
fixed (byte* p = buffer) {
108108
var data = NSData.FromBytes ((IntPtr) p, (uint) stream.Length);

0 commit comments

Comments
 (0)