fix(android): bloom_read_file returns empty string not null on missing file + v0.4.16#62
Merged
Merged
Conversation
…ing file
Android's bloom_read_file returned std::ptr::null() on read error. Perry treats
the *const u8 return as a string; .length/.charCodeAt then dereference a null
StringHeader and SIGSEGV (fault addr 0xff..f8). native/linux already returns a
valid empty Perry string here — this is a straight parity fix.
Repro: jump's discoverLevels() probes level1..level10 + custom_* via readFile()
without a fileExists guard (expecting '' for missing files, as on desktop). The
first missing file segfaulted the game thread right after tapping Play.
Fix: match linux — Ok => alloc_perry_string(&contents), Err => alloc_perry_string("").
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.
Android
bloom_read_filereturnedstd::ptr::null()on read error. Perry treats the return as a string, so.length/.charCodeAtdereference a nullStringHeader→ SIGSEGV (fault addr 0xff..f8).native/linuxalready returns a valid empty Perry string here (with an explanatory comment) — this is a straight parity fix.Repro: jump's
discoverLevels()probeslevel1..level10+custom_*viareadFile()with nofileExistsguard (expects""for missing files, as on desktop). On Android the first missing file (level6.txt) returned null → segfault ondata.lengthimmediately after tapping Play. Root-caused on-device with a numeric beacon trail; verified the fix renders Level Select + gameplay on a physical Adreno device.Fix:
Ok => alloc_perry_string(&contents),Err => alloc_perry_string(""). Bumps to v0.4.16.