Skip to content

Implement fallback for corrupted nvram.vmp and similar files  #254

Description

@izzyreal

For various reasons, files VMPC2000XL tries to load may become corrupted. At the moment, for nvram.vmp, and maybe some other files too, we only check if the file exists, and then assume it is healthy. For nvram.vmp in particular, see DefaultsParser::AllDefaultsFromFile. But we should try to find other places that make the same assumption as well, and then everywhere implement detection of corruption, and a fallback mechanism. In most cases, adding a file-size check on top of the file-exists check should suffice, so let's start with that. Additionally we may delete or rename the corrupted file, to ensure there's no attempt of loading it again.

Actual crash log submitted by Nino Beatz:

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Codes: 0x0000000000000001, 0x0000000000000000
VM Region Info: 0 is not in any region.  Bytes before following region: 4378378240
      REGION TYPE                 START - END      [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                   104f8c000-105370000 [ 3984K] r-x/r-x SM=COW  /var/containers/Bundle/Application/212A9F9C-42A4-4F58-A250-D21D109054F8/VMPC2000XL.app/PlugIns/VMPC2000XL.appex/VMPC2000XL
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [521]

Triggered by Thread:  0

Thread 0 name:   Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_platform.dylib      	       0x202abbab0 _platform_memmove + 144
1   VMPC2000XL                    	       0x105107728 mpc::Util::vecCopyOfRange(std::__1::vector<char, std::__1::allocator<char>> const&, int, int) + 88
2   VMPC2000XL                    	       0x10531e148 mpc::nvram::DefaultsParser::AllDefaultsFromFile(mpc::Mpc&, ghc::filesystem::path) + 56
3   VMPC2000XL                    	       0x1053229a8 mpc::nvram::NvRam::loadUserScreenValues(mpc::Mpc&) + 404
4   VMPC2000XL                    	       0x1050fd50c mpc::Mpc::init() + 6060

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions