Crash (SIGSEGV / stack overflow) in CryptoIOFile::ReadAtImpl during game list scan. Infinite recursion
Is there an existing issue for this?
- I have searched the existing issues
Affected Build(s)
AzaharPlus-dab27d996 (commit dab27d9)
Description of Issue
Description: After the latest AzaharPlus update (installed in "replace" mode over the previous install), the game list fails to load: the app scans the ROM folder on startup and consistently crashes partway through, before the list is ever displayed. The crash is silent from the user's perspective (app closes, returns to home screen, no error dialog).
Analysis / suspected cause: Only ROMs that go through the "Force no crypto scheme" path (already-decrypted exheader) load successfully. The crash appears to be triggered specifically when the scanner encounters a ROM that goes through the normal CryptoIOFile decryption path (an actually-encrypted NCCH), suggesting a regression in CryptoIOFile::ReadAtImpl where it recurses into itself instead of calling the underlying file object's read implementation.
Additional notes: Happy to provide the full log file / logcat, or test a debug build if useful. Can also try to identify and share the specific ROM triggering this, if that would help narrow it down.
Expected Behavior
The game list scan should read encrypted NCCH headers via CryptoIOFile without recursing infinitely, and complete the scan without crashing.
Reproduction Steps
- Have a ROM folder containing a mix of .3ds files, at least one of which is a genuinely encrypted NCCH (i.e. does not trigger the "Force no crypto scheme" warning that most of my other ROMs show).
- Launch AzaharPlus and let it scan the ROM directory for the game list.
- The app crashes during the scan, without any error message.
Log File
Log output (citra_log.txt): The app-side log always cuts off mid-line at the moment of the crash (confirms it's a native crash, not a logging artifact):
[...]
HW <Error> core/zip_pass.cpp:importQueuedZipPass:328: importQueuedZipPass
Frontend <Error> core/zip_pass.cpp:zipPassChecks:100: nHomes 1
Service.FS <Warning> core/file_sys/ncch_container.cpp:Load:405: NCCH is marked as encrypted but with decrypted exheader. Force no crypto scheme.
[... repeated for most ROMs, each producing this warning and loading fine ...]
Loader <Warning> core/loader/loader.cpp:GetLoader:172: File ... has a different type than its extension.
[log cuts off here — crash occurs before flush]adb logcat at crash time:
F libc: Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x744d191ff0 in tid 19038 (DefaultDispatch), pid 19009 (lime3ds.android)
F DEBUG: Cause: stack pointer is close to top of stack; likely stack overflow.
F DEBUG: backtrace:
#00 pc ... libcitra-android.so (FileUtil::IOFile::ReadAtImpl(void*, unsigned long, unsigned long)+0)
#01 pc ... libcitra-android.so (FileUtil::CryptoIOFile::ReadAtImpl(void*, unsigned long, unsigned long)+56)
#02 pc ... libcitra-android.so (FileUtil::CryptoIOFile::ReadAtImpl(void*, unsigned long, unsigned long)+56)
#03 pc ... libcitra-android.so (FileUtil::CryptoIOFile::ReadAtImpl(void*, unsigned long, unsigned long)+56)
[... same frame repeats ~198 times ...]FileUtil::CryptoIOFile::ReadAtImpl appears to call itself recursively instead of delegating to the wrapped IOFile, exhausting the stack and crashing with SIGSEGV.
System Configuration
App: AzaharPlus (package io.github.lime3ds.android) Version: dab27d9 | AzaharPlus-dab27d996 Platform: Android 13 (API 33) Device: AYN Thor (SoC: Qualcomm QCS8550, GPU: Adreno 740) RAM: 15.0 GB
Source: azahar-emu/azahar