Skip to content

Commit

Permalink
Revert SkipPureWhitespace back to what it used to be
Browse files Browse the repository at this point in the history
No memory mapped files now, so Access Violation Errors should no longer occur.
  • Loading branch information
sonicfind committed Sep 30, 2024
1 parent 414dab9 commit 9e8a87e
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions YARG.Core/IO/TextReader/YARGTextReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,11 @@ public static void SkipPureWhitespace<TChar>(ref YARGTextContainer<TChar> contai
// Explicitly dereferencing the pointer into a value first avoids this issue. The useless `cmp`
// is still generated, but now `rax` points to the stack, and so the over-read is always done in
// a valid memory space.

// while (container.Position < container.End && container.Position->ToInt32(null) <= 32)
while (container.Position < container.End)
//
// 9/28 Edit: However, now that fixedArray removed memorymappedfile functionality, the overread is a non-issue
// in terms of causing any actual access violation errors
while (container.Position < container.End && container.Position->ToInt32(null) <= 32)
{
var c = *container.Position;
if (c.ToInt32(null) > 32)
{
break;
}
++container.Position;
}
}
Expand Down

0 comments on commit 9e8a87e

Please sign in to comment.