Use Stream extension to ensure read operations return the requested number of bytes (unless EOF arrives first).

This commit is contained in:
2022-11-14 09:43:16 +00:00
parent f90cc6593f
commit 0eb589d785
178 changed files with 862 additions and 780 deletions

View File

@@ -37,6 +37,7 @@ using System.IO;
using System.Text.RegularExpressions;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
public sealed partial class Gdi
{
@@ -48,7 +49,7 @@ public sealed partial class Gdi
{
imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin);
var testArray = new byte[512];
imageFilter.GetDataForkStream().Read(testArray, 0, 512);
imageFilter.GetDataForkStream().EnsureRead(testArray, 0, 512);
imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin);
// Check for unexpected control characters that shouldn't be present in a text file and can crash this plugin