Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mariani crashes on launch (without hack) #3

Open
sh95014 opened this issue Feb 16, 2022 · 8 comments
Open

Mariani crashes on launch (without hack) #3

sh95014 opened this issue Feb 16, 2022 · 8 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@sh95014
Copy link
Owner

sh95014 commented Feb 16, 2022

To Reproduce
Steps to reproduce the behavior:

  1. Remove the hack in MarianiFrame.h
    Uint8 padding[1];
  1. Build and run

Actual behavior
Crashes on launch.

Versions (please complete the following information):

  • OS: macOS 12.2.1
  • Mariani: e00a81e
@sh95014 sh95014 added the bug Something isn't working label Feb 16, 2022
@sh95014
Copy link
Owner Author

sh95014 commented Feb 18, 2022

With Address Sanitizer enabled, pretty sure this is the culprit:

2022-02-18 11:52:11.916744-0800 Mariani[31299:418703] =================================================================
2022-02-18 11:52:11.916791-0800 Mariani[31299:418703] ==31299==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x00010a53f5e0 at pc 0x00010529f2ac bp 0x00016bc22470 sp 0x00016bc21c28
2022-02-18 11:52:11.916814-0800 Mariani[31299:418703] WRITE of size 24 at 0x00010a53f5e0 thread T0
2022-02-18 11:52:11.916837-0800 Mariani[31299:418703]     #0 0x10529f2a8 in __asan_memset+0x104 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x3b2a8)
2022-02-18 11:52:11.916857-0800 Mariani[31299:418703]     #1 0x1041e6188 in mariani::MarianiFrame::MarianiFrame(common2::EmulatorOptions const&) MarianiFrame.cpp:17
2022-02-18 11:52:11.916879-0800 Mariani[31299:418703]     #2 0x1042c7d34 in -[EmulatorViewController awakeFromNib] EmulatorViewController.mm:102

but I can't quite figure out where in the constructor chain this is happening.

@sh95014
Copy link
Owner Author

sh95014 commented Dec 29, 2022

Still an issue with Xcode 14.2.0 on macOS 13.1.

@sh95014
Copy link
Owner Author

sh95014 commented May 30, 2023

=================================================================
==73857==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x000107a3bb68 at pc 0x0001026c0740 bp 0x00016d759f00 sp 0x00016d759ef8
WRITE of size 8 at 0x000107a3bb68 thread T0
    #0 0x1026c073c in std::__1::__compressed_pair_elem<unsigned char*, 0, false>::__compressed_pair_elem<std::nullptr_t, void>(std::nullptr_t&&) compressed_pair.h:51
    #1 0x1026c06b0 in std::__1::__compressed_pair<unsigned char*, std::__1::allocator<unsigned char>>::__compressed_pair<std::nullptr_t, std::__1::__default_init_tag>(std::nullptr_t&&, std::__1::__default_init_tag&&) compressed_pair.h:136
    #2 0x1026c066c in std::__1::__compressed_pair<unsigned char*, std::__1::allocator<unsigned char>>::__compressed_pair<std::nullptr_t, std::__1::__default_init_tag>(std::nullptr_t&&, std::__1::__default_init_tag&&) compressed_pair.h:136
    #3 0x1026c0524 in std::__1::__vector_base<unsigned char, std::__1::allocator<unsigned char>>::__vector_base() vector:460
    #4 0x1026c0320 in std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>::vector() vector:519
    #5 0x1026c02f4 in std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>::vector() vector:520
    #6 0x1026be394 in common2::CommonFrame::CommonFrame() commonframe.h:10
    #7 0x1026be228 in mariani::MarianiFrame::MarianiFrame(common2::EmulatorOptions const&) MarianiFrame.cpp:20
    #8 0x1028db268 in -[EmulatorViewController awakeFromNib] EmulatorViewController.mm:110

@sh95014
Copy link
Owner Author

sh95014 commented Jun 12, 2023

Looks pretty clear that the root cause is the chain of constructors starting from MarianiFrame, but I really can't figure out what's going on, and the hack required to keep things running is now:

    // FIXME: without this hack the app crashes randomly elsewhere
    unsigned char padding[1024];

Next step might be an experiment to pull in everything manually from the ancestor classes and see if that sidesteps things.

Or #37 might help.

f02241d

@sh95014
Copy link
Owner Author

sh95014 commented Jun 13, 2023

https://github.com/sh95014/AppleWin/tree/x-consolidate-frames is an attempt to consolidate the code from SDLFrame, CommonFrame, and LinuxFrame into MarianiFrame to get away from any multiple inheritance weirdness. Unfortunately, that still doesn't fix the crash.

sh95014 added a commit that referenced this issue Jun 13, 2023
See #3
@sh95014 sh95014 added the help wanted Extra attention is needed label Jun 14, 2023
@sh95014
Copy link
Owner Author

sh95014 commented Dec 13, 2023

@sh95014
Copy link
Owner Author

sh95014 commented Dec 24, 2023

Nope, but seems to go away if I comment out:

    CConfigNeedingRestart myHardwareConfig;

in CommonFrame...

@sh95014
Copy link
Owner Author

sh95014 commented Jul 7, 2024

Still happens with Address Sanitizer enabled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant