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
Memory corruption in 1.11.0-beta2 on Android NDK in multiplayer servers list #8799
Comments
Since this is a (somewhat) unsupported platform that you're compiling yourself, perhaps you can help by bisecting to find which commit introduced the problem? Perhaps it could also be reproduced on a "standard" system by compiling with Clang's stdlib, libc++ which may be what's being used here. Using CXXFLAGS="-stdlib=libc++" when running cmake should be enough to force that |
The bug was not present in Beta1.
I will try to compile it on Linux using clang and run with Valgrind.
…On Wed, Mar 3, 2021 at 2:26 AM Charles Pigott ***@***.***> wrote:
Since this is a (somewhat) unsupported platform that you're compiling
yourself, perhaps you can help by bisecting to find which commit introduced
the problem?
Perhaps it could also be reproduced on a "standard" system by compiling
with Clang's stdlib, libc++ which may be what's being used here. Using
CFLAGS=-stdlib=libc++ when running cmake should be enough to force that
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#8799 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABF5QHACVQ4SW22O23ROG3TBV623ANCNFSM4YP7UZVA>
.
|
Also if you have any more indication besides "crashing", that would be of great help. A That said, I cannot reproduce this problem with clang on x86_64. |
I can reproduce this on both ARM64 and Intel on Mac - attached is an arm64 log, but it's happening on my x86_64 MacBook Pro too: |
That basically confirms libc++ is to blame, macOS will be using it for all platforms |
On Linux, after installing
More detailed crashlog:
|
OpenTTD/src/network/network_gui.cpp Line 336 in 73fd634
NGameClientSorter(b, a) would probably be better.
|
Spot on @JGRennison . And to be clear, this was not memory corruption; this is reading a vector out-of-bounds. Slight nuance :) |
…relation (#8801) In other words, it should only (!) return true if A comes for B. This promise was broken for the situation where two values are identical. It would return true in these cases too. This is of course not possible: if two values are identical, neither come before the other. As such, the sorter was not imposing strict weak ordering relations. libstdc++ handled this scenario just fine, but libc++ crashes badly on this, as it allowed comparing of [begin, end] instead of [begin, end). libc++ considered this not a bug (and by specs, they are correct; just this way of crashing is of course a bit harsh): https://bugs.llvm.org/show_bug.cgi?id=47903
This patch fixes the crash in Android version, thanks.
…On Wed, 3 Mar 2021, 14:12 Charles Pigott, ***@***.***> wrote:
Closed #8799 <#8799> via #8801
<#8801>.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#8799 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABF5QBFQRAWQGFSPKJVVGLTBYRT5ANCNFSM4YP7UZVA>
.
|
Version of OpenTTD
1.11.0-beta2, built with Android NDK arm64.
Expected result
OpenTTD does not crash
Actual result
OpenTTD crashes
Steps to reproduce
Run OpenTTD, click 'Multiplayer', click 'Search internet'. OpenTTD crashes with 70% probability.
Reproduced when OpenTTD is built with clang from Android NDK for arm64 architecture, not reproduced on GCC x86_64.
Please check it with Valgrind or something, I suspect the problem is because of different C++ standard library.
The text was updated successfully, but these errors were encountered: