Skip to content

Crash on not before empty expression group #7233

@Diederikjh

Description

@Diederikjh

Goal

I had a bug in my realm query that generated an empty beginGroup and endGroup pair.

Actual Results

2020-12-04 14:59:21.571 11732-11806/<app-id> A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x48 in tid 11806 (ptileTestRunner)
2020-12-04 14:59:21.648 11812-11812/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2020-12-04 14:59:21.648 11812-11812/? A/DEBUG: Build fingerprint: 'google/sdk_google_phone_x86/generic_x86:7.0/NYC/4409132:user/release-keys'
2020-12-04 14:59:21.648 11812-11812/? A/DEBUG: Revision: '0'
2020-12-04 14:59:21.648 11812-11812/? A/DEBUG: ABI: 'x86'
2020-12-04 14:59:21.648 11812-11812/? A/DEBUG: pid: 11732, tid: 11806, name: ptileTestRunner  >>> <app-id> <<<
2020-12-04 14:59:21.648 11812-11812/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x48
2020-12-04 14:59:21.649 11812-11812/? A/DEBUG:     eax 9b3ab800  ebx 893eb1ec  ecx 00000000  edx 89953a34
2020-12-04 14:59:21.649 11812-11812/? A/DEBUG:     esi a6be0008  edi 00000000
2020-12-04 14:59:21.649 11812-11812/? A/DEBUG:     xcs 00000073  xds 0000007b  xes 0000007b  xfs 0000003b  xss 0000007b
2020-12-04 14:59:21.649 11812-11812/? A/DEBUG:     eip 88fb64ce  ebp 89953a28  esp 899539e0  flags 00010282
2020-12-04 14:59:21.662 11812-11812/? A/DEBUG: backtrace:
2020-12-04 14:59:21.662 11812-11812/? A/DEBUG:     #00 pc 004304ce  /data/app/<app-id>-1/lib/x86/librealm-jni.so
2020-12-04 14:59:21.663 11812-11812/? A/DEBUG:     #01 pc 00568031  /data/app/<app-id>-1/lib/x86/librealm-jni.so
2020-12-04 14:59:21.663 11812-11812/? A/DEBUG:     #02 pc 0043059c  /data/app/<app-id>-1/lib/x86/librealm-jni.so
2020-12-04 14:59:21.663 11812-11812/? A/DEBUG:     #03 pc 0043061a  /data/app/<app-id>-1/lib/x86/librealm-jni.so
2020-12-04 14:59:21.663 11812-11812/? A/DEBUG:     #04 pc 0043a1ae  /data/app/<app-id>-1/lib/x86/librealm-jni.so
2020-12-04 14:59:21.663 11812-11812/? A/DEBUG:     #05 pc 00431f6b  /data/app/<app-id>-1/lib/x86/librealm-jni.so
2020-12-04 14:59:21.663 11812-11812/? A/DEBUG:     #06 pc 000ff854  /data/app/<app-id>-1/lib/x86/librealm-jni.so (Java_io_realm_internal_TableQuery_nativeEndGroup+36)
2020-12-04 14:59:21.663 11812-11812/? A/DEBUG:     #07 pc 01ab92f4  /data/app/<app-id>-1/oat/x86/base.odex (offset 0x1853000)

Steps & Code to Reproduce

This code snippet seems to reproduce it reliably.

 try (Realm realm = Realm.getInstance(config)) {
            realm.where(Task.class)
                    .equalTo("type", "boom?")
                    .and().not().beginGroup().endGroup();
        }

Note empty group, and not seems to trigger this. Realm config is all default with inMemory set in this case, but happens for on disk realm as well.

Version of Realm and tooling

Realm version(s): ?
Android lib 10.1.2

Realm Sync feature enabled: No

Android Studio version: ? 4.1.1

Android Build Tools version: ? com.android.tools.build:gradle:3.4.0

Gradle version: ? 5.3.1

Which Android version and device(s): ? Android emulator running Android 7

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions