Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27adea86 authored by Fyodor Kupolov's avatar Fyodor Kupolov
Browse files

Throw clear error if a row doesn't fit into CursorWindow

Test: android.database.sqlite.cts.SQLiteCursorTest
Bug: 66946862
Change-Id: I0b3c7c8c0a4aac2f4b024c579b482cebe79231c0
parent 3f26e5e1
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -765,6 +765,14 @@ static jlong nativeExecuteForCursorWindow(JNIEnv* env, jclass clazz,
    if (startPos > totalRows) {
        ALOGE("startPos %d > actual rows %d", startPos, totalRows);
    }
    if (totalRows > 0 && addedRows == 0) {
        String8 msg;
        msg.appendFormat("Row too big to fit into CursorWindow requiredPos=%d, totalRows=%d",
                requiredPos, totalRows);
        throw_sqlite3_exception(env, SQLITE_TOOBIG, NULL, msg.string());
        return 0;
    }

    jlong result = jlong(startPos) << 32 | jlong(totalRows);
    return result;
}