I was remotely debugging JS in React Native app and tried to pass an object to Realm.create with another nested object, one of properties of which is a string, that contains UTF-32 symbol.
I expected nothing.
App crashed.
I've made minimal testcase, which you can find here. App crashes constantly, in 100% of tries.
realm.write(() => {
realm.create('Item', {
id: 'test',
randomName: {
// String with any UTF-32 symbol with code >= 10000.
// Strings with U+00009999 and lower are fine, strings with U+00010000 and higher cause crashes.
otherRandomName: '馃槉',
},
}, true);
});
Do you see a crash if you run your test app on iOS?
I don't have a way to test it, so I can't really tell.
I tested on iOS, it works, no crash! Looks likes, it's an Android bug only!
@ovr Thanks for clarifying.
Tested on Android 6.x by emulator via RemoteJS by
The bug can be reproduced on my real device (Sony Xperia Z1) with Android version 5.1.1. and can't be reproduced on emulator with Android 8 (API 26).
```* thread #31, name = 'NanoHttpd Reque', stop reason = signal SIGABRT
tgkill + 22
frame #1: 0xb74ea17c libc.sopthread_kill + 156raise + 37
frame #3: 0xb74e3df5 libc.soabort + 85__gnu_cxx::__verbose_terminate_handler() + 453
frame #5: 0xa1539398 librealmreact.so__cxxabiv1::__terminate(void (*)()) + 24std::terminate() + 32
frame #7: 0xa1539571 librealmreact.so__cxa_throw + 113___lldb_unnamed_symbol7708$$librealmreact.so + 370
frame #9: 0xa1171bf2 librealmreact.so___lldb_unnamed_symbol7694$$librealmreact.so + 1930___lldb_unnamed_symbol7694$$librealmreact.so + 660
frame #11: 0xa11719c0 librealmreact.so___lldb_unnamed_symbol7694$$librealmreact.so + 1368___lldb_unnamed_symbol7694$$librealmreact.so + 660
frame #13: 0xa11719c0 librealmreact.so___lldb_unnamed_symbol7694$$librealmreact.so + 1368___lldb_unnamed_symbol7694$$librealmreact.so + 660
frame #15: 0xa11719c0 librealmreact.so___lldb_unnamed_symbol7694$$librealmreact.so + 1368___lldb_unnamed_symbol7694$$librealmreact.so + 660
frame #17: 0xa11709f7 librealmreact.so___lldb_unnamed_symbol7678$$librealmreact.so + 85```Looks likes, it's fixed by https://github.com/realm/realm-js/commit/7a039d5407a0345bdd6cb3c2cec154b4455d003c#diff-7c0bbffb2b1d56242c8b6670362aa936R161 in v2.2.2
@angly-cat can you verify?
Still crashes with Realm 2.2.2.
Can be reproduced in avd emulator with Android 5.1.
@angly-cat Thanks for the update. I hope to be able to investigate a bit early next week.
The issue still persists as per realm 2.28.
Apparently, only Android devices with API level 22 (Lopipop) or below are affected.
In logcat crashes are described as JNI DETECTED ERROR IN APPLICATION: input is not valid Modified UTF-8: illegal start byte.
This is a known bug for older Android APIs.
I've found an issue with the same error message in another project.
And apparently they've fixed that by making a patch.
@kneth please check if it's possible to adapt their fix to realm. It's not a top-priority issue, but if the fix can be done easily, then why not.
@lebedev Thank you for investigating. I hope to have some time soon to integrate the patch (or a similar approach).