Scanning NE files throws exception #172

Closed
opened 2026-01-29 21:06:46 +00:00 by claunia · 5 comments
Owner

Originally created by @Hendi48 on GitHub (May 12, 2024).

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.

Originally created by @Hendi48 on GitHub (May 12, 2024). 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`.
Author
Owner

@mnadareski commented on GitHub (May 12, 2024):

The issue seen above seems to have been fixed from a combination of unrelated changes including 66da74e00a. This item will be left open until BOS gets the library updates that actually allow this to be fixed, however.

@mnadareski commented on GitHub (May 12, 2024): 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.
Author
Owner

@mnadareski commented on GitHub (May 13, 2024):

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

@mnadareski commented on GitHub (May 13, 2024): 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
Author
Owner

@mnadareski commented on GitHub (May 15, 2024):

Newest BOS rolling release (https://github.com/SabreTools/BinaryObjectScanner/releases/tag/rolling) includes the changes above. Please test when possible.

@mnadareski commented on GitHub (May 15, 2024): Newest BOS rolling release (https://github.com/SabreTools/BinaryObjectScanner/releases/tag/rolling) includes the changes above. Please test when possible.
Author
Owner

@Hendi48 commented on GitHub (May 16, 2024):

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.

@Hendi48 commented on GitHub (May 16, 2024): 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.
Author
Owner

@TheRogueArchivist commented on GitHub (Jun 11, 2024):

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.

@TheRogueArchivist commented on GitHub (Jun 11, 2024): 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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SabreTools/BinaryObjectScanner#172