Merge "[DO NOT MERGE] Throw exception if slot has invalid offset" into mnc-dev am: d2699d009b am: 4130501c19

am: 3a8534f18e

Change-Id: I08dab5efd089c0cb7b93638d81cba96efad2d322
This commit is contained in:
Fyodor Kupolov
2017-03-10 02:05:45 +00:00
committed by android-build-merger

View File

@@ -182,6 +182,10 @@ static jbyteArray nativeGetBlob(JNIEnv* env, jclass clazz, jlong windowPtr,
if (type == CursorWindow::FIELD_TYPE_BLOB || type == CursorWindow::FIELD_TYPE_STRING) {
size_t size;
const void* value = window->getFieldSlotValueBlob(fieldSlot, &size);
if (!value) {
throw_sqlite3_exception(env, "Native could not read blob slot");
return NULL;
}
jbyteArray byteArray = env->NewByteArray(size);
if (!byteArray) {
env->ExceptionClear();
@@ -217,6 +221,10 @@ static jstring nativeGetString(JNIEnv* env, jclass clazz, jlong windowPtr,
if (type == CursorWindow::FIELD_TYPE_STRING) {
size_t sizeIncludingNull;
const char* value = window->getFieldSlotValueString(fieldSlot, &sizeIncludingNull);
if (!value) {
throw_sqlite3_exception(env, "Native could not read string slot");
return NULL;
}
if (sizeIncludingNull <= 1) {
return gEmptyString;
}