BinaryObjectScanner
BinaryObjectScanner copied to clipboard
Scanning NE files throws exception
I have a couple discs containing Win3.11 binaries and BinaryObjectScanner runs into an exception opening them on net8.0.
System.IO.EndOfStreamException
HResult=0x80070026
Message=Requested to read length bytes from stream, 1348792 returned
Source=SabreTools.IO
StackTrace:
at SabreTools.IO.Extensions.StreamReaderExtensions.ReadToBuffer(Stream stream, Int32 length)
at SabreTools.IO.Extensions.StreamReaderExtensions.ReadBytes(Stream stream, Int32 count)
at SabreTools.Serialization.Wrappers.WrapperBase`1.ReadFromDataSource(Int32 position, Int32 length)
at SabreTools.Serialization.Wrappers.NewExecutable.ReadArbitraryRange(Int32 rangeStart, Int32 length)
at BinaryObjectScanner.Protection.RainbowSentinel.CheckNewExecutable(String file, NewExecutable nex, Boolean includeDebug) in RainbowSentinel.cs:line 46
at BinaryObjectScanner.FileType.Executable.<>c__DisplayClass28_0.<RunNewExecutableChecks>b__0(INewExecutableCheck checkClass) in Executable.cs:line 436
at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`2.<ForWorker>b__1(RangeWorker& currentWorker, Int64 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
Btw. there seems to be a misplaced nameof()
in SabreTools.IO.
It's not exclusive to RainbowSentinel, this throws in all modules utilizing ReadArbitraryRange
.
The issue seen above seems to have been fixed from a combination of unrelated changes including https://github.com/SabreTools/SabreTools.Serialization/commit/66da74e00a3e67cb978dfff68e399c2e72d761dc. This item will be left open until BOS gets the library updates that actually allow this to be fixed, however.
The changes that should have fixed this are now in the rolling release of Serialization. The test program for that library can be found here: https://github.com/SabreTools/SabreTools.Serialization/releases/tag/rolling
Newest BOS rolling release (https://github.com/SabreTools/BinaryObjectScanner/releases/tag/rolling) includes the changes above. Please test when possible.
It's not fixed, unfortunately. The exception string is better now.
I analyzed the root cause and found that it's a concurrency issue. The NE scans are done using TPL. In ReadFromDataSource
there's a Seek/Read/Seek
sequence that will fault when not guarded against concurrent execution.
Hello, it should be fixed within the newest rolling release (https://github.com/SabreTools/BinaryObjectScanner/releases/tag/rolling), I'd been running into the same issues personally and made sure they're fixed now.