Repository navigation
Fix mmread hang at EOF and BoundsError without trailing newline - #155
Open
ViralBShah wants to merge 1 commit into
Open
ViralBShah wants to merge 1 commit into
ViralBShah wants to merge 1 commit into
Conversation
- mmread and mmreadheader looped forever when the file ended before the size line (e.g. header only, or header plus comments). Now raise Meta.ParseError / DataError respectively. - _parsenext read past the end of the buffer when the last number was not followed by whitespace. Treat end of buffer as a terminator inside a number; a missing number still raises BoundsError as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #155 +/- ##
==========================================
- Coverage 99.95% 99.91% -0.05%
==========================================
Files 14 14
Lines 2387 2391 +4
==========================================
+ Hits 2386 2389 +3
- Misses 1 2 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mmreadandmmreadheaderlooped forever on a file containing only%%MatrixMarket matrix coordinate real general\n(or header plus%comments). They now throwMeta.ParseErrorandDataErrorrespectively.BoundsErrorwithout a trailing newline:%%MatrixMarket matrix coordinate real general\n2 2 1\n1 1 1.5(no final\n) threwBoundsError: attempt to access 7-element Vector{UInt8} at index [8]. The same happened for integer and dense array files._parsenextnow treats the end of the buffer as the end of a number. This costs the same single comparison as the bounds check it replaces, and the mmapped buffer is not copied. Truncated data (fewer entries than declared) still throwsBoundsError, as the existing tests expect.Tests: I added regression tests to
test/download.jlfor coordinate (real, integer, pattern, complex) and array (real, integer, complex) files without a final newline, read both from files and fromIOBuffers. The EOF cases run in a subprocess with a time limit, so a regression fails the test instead of hanging the suite.Pkg.test()passes on Julia 1.13.🤖 Generated with Claude Code