diff options
| author | 2017-03-10 02:00:07 +0000 | |
|---|---|---|
| committer | 2017-03-10 02:00:07 +0000 | |
| commit | 3a8534f18e9f15af7749481cab4a0d538cd41c1c (patch) | |
| tree | 32ab387669ab4017be307c67cbe1b9482c5e2212 | |
| parent | d08ec589b2fd862714982301dda66cb643b97e58 (diff) | |
| parent | 4130501c192c8a141d926014a220fec1c7379499 (diff) | |
Merge "[DO NOT MERGE] Throw exception if slot has invalid offset" into mnc-dev am: d2699d009b
am: 4130501c19
Change-Id: I9ee79ce0bc865fd3edb1fe67df6402ed1abb7c8c
| -rw-r--r-- | core/jni/android_database_CursorWindow.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/jni/android_database_CursorWindow.cpp b/core/jni/android_database_CursorWindow.cpp index 580ac02789c5..a86e57dc024c 100644 --- a/core/jni/android_database_CursorWindow.cpp +++ b/core/jni/android_database_CursorWindow.cpp @@ -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; } |