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

Test: android.database.sqlite.cts.SQLiteCursorTest
Bug: 66946862
Change-Id: I0b3c7c8c0a4aac2f4b024c579b482cebe79231c0
This commit is contained in:
Fyodor Kupolov
2017-10-18 15:03:21 -07:00
parent 3f26e5e1f1
commit 27adea867d

View File

@@ -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;
}