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

mgba-qt crashes when opening zipped ROM on FreeBSD #1777

Closed
Digital-Chaos opened this issue Jun 5, 2020 · 9 comments
Closed

mgba-qt crashes when opening zipped ROM on FreeBSD #1777

Digital-Chaos opened this issue Jun 5, 2020 · 9 comments

Comments

@Digital-Chaos
Copy link

@Digital-Chaos Digital-Chaos commented Jun 5, 2020

Arch: amd64
OS: FreeBSD-12.1
mgba: 0.8.1

"mgba-qt" crashes when opening zipped ROM, but works when manually unzipping the ROM first and loading the unzipped version.

"mgba" can open both zipped and unzipped ROM with no issues.

lldb backtrace;

 % lldb -f mgba-qt -- ./advance-wars.zip            
(lldb) target create "/usr/local/bin/mgba-qt"
Current executable set to '/usr/local/bin/mgba-qt' (x86_64).
(lldb) settings set -- target.run-args  "./advance-wars.zip"
(lldb) run
Process 3200 launching
Process 3200 launched: '/usr/local/bin/mgba-qt' (x86_64)
Process 3200 stopped
* thread #1, name = 'mgba-qt', stop reason = signal SIGSEGV: invalid address (fault address: 0x80a304003)
    frame #0: 0x0000000802124f55 libc.so.7`memcpy + 245
libc.so.7`memcpy:
->  0x802124f55 <+245>: movb   (%rsi), %dl
    0x802124f57 <+247>: movb   %dl, (%rdi)
    0x802124f59 <+249>: retq   
    0x802124f5a <+250>: nopw   (%rax,%rax)
(lldb) bt
* thread #1, name = 'mgba-qt', stop reason = signal SIGSEGV: invalid address (fault address: 0x80a304003)
  * frame #0: 0x0000000802124f55 libc.so.7`memcpy + 245
    frame #1: 0x00000008006fcae5 libmgba.so.0.8`___lldb_unnamed_symbol2503$$libmgba.so.0.8 + 53
    frame #2: 0x00000008006ce1d2 libmgba.so.0.8`GBAIsROM + 82
    frame #3: 0x0000000800665773 libmgba.so.0.8`mCoreFindVF + 19
    frame #4: 0x0000000000325c19 mgba-qt`___lldb_unnamed_symbol809$$mgba-qt + 57
    frame #5: 0x00000000003255b4 mgba-qt`___lldb_unnamed_symbol808$$mgba-qt + 660
    frame #6: 0x00000000003e0c74 mgba-qt`___lldb_unnamed_symbol1877$$mgba-qt + 276
    frame #7: 0x000000000030edfc mgba-qt`___lldb_unnamed_symbol545$$mgba-qt + 1804
    frame #8: 0x00000000003006c0 mgba-qt`___lldb_unnamed_symbol1$$mgba-qt + 256
(lldb) quit
@endrift
Copy link
Member

@endrift endrift commented Jun 6, 2020

Is this built from the port? Seems to be 0.7.3 still, so I presume not. Assuming you did build it yourself do you still have the build directory around?

@Digital-Chaos
Copy link
Author

@Digital-Chaos Digital-Chaos commented Jun 6, 2020

Hi endrift, I was updating the FreeBSD port from 0.7.3 to 0.8.1 when I noticed this issue, although both versions produce the same error on my laptop running FreeBSD 12.1-STABLE, and also my desktop running FreeBSD 12.1-RELEASE.

FreeBSD Bugzilla;
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247007

I still have the build directory available, if you need any further info please let me know! :-)

@endrift
Copy link
Member

@endrift endrift commented Jun 6, 2020

Can you try running cmake . in the build directory (the one with the CMakeCache.txt file) and give me the output? After, can you rebuild as debug (cmake . -DCMAKE_BUILD_TYPE=Debug) and see if it still crashes? And if so, the backtrace?

@Digital-Chaos
Copy link
Author

@Digital-Chaos Digital-Chaos commented Jun 6, 2020

Can you try running cmake . in the build directory (the one with the CMakeCache.txt file) and give me the output? After, can you rebuild as debug (cmake . -DCMAKE_BUILD_TYPE=Debug) and see if it still crashes? And if so, the backtrace?

I've managed to fix it by adding a port dependency on archivers/libzip, so that CMake detects and uses that implementation instead of the internal contrib/minizip.

@endrift
Copy link
Member

@endrift endrift commented Jun 6, 2020

Interesting. I'll take a look at what minizip is doing differently. Thanks for the heads up.

@Digital-Chaos
Copy link
Author

@Digital-Chaos Digital-Chaos commented Jun 6, 2020

It's minizip for sure, even if I use the FreeBSD ports provided version archivers/minizip instead of the bundled internal version it crashes.

@Digital-Chaos
Copy link
Author

@Digital-Chaos Digital-Chaos commented Jun 6, 2020

I'll just update the port to use libzip instead, unless there is a reason minizip is preferred?

@endrift
Copy link
Member

@endrift endrift commented Jun 6, 2020

Both are fine. I'll look into the minizip issue though. It seems fine with minizip on Linux though, but I haven't had a chance to check on FreeBSD yet today.

@endrift endrift closed this in 1db01d6 Jun 7, 2020
@Digital-Chaos
Copy link
Author

@Digital-Chaos Digital-Chaos commented Jun 7, 2020

Fix works fine here too! Thanks for sorting it quickly, and supporting FreeBSD! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.