Merge "[DO NOT MERGE] Throw exception if slot has invalid offset" into nyc-dev am: 69d20eab85 am: d098c42ebe am: a5affd0726
am: 236e162b3e
Change-Id: I84e082e8deafadf86db3eee683285a07f11c219f
This commit is contained in:
@@ -205,6 +205,10 @@ static jbyteArray nativeGetBlob(JNIEnv* env, jclass clazz, jlong windowPtr,
|
|||||||
if (type == CursorWindow::FIELD_TYPE_BLOB || type == CursorWindow::FIELD_TYPE_STRING) {
|
if (type == CursorWindow::FIELD_TYPE_BLOB || type == CursorWindow::FIELD_TYPE_STRING) {
|
||||||
size_t size;
|
size_t size;
|
||||||
const void* value = window->getFieldSlotValueBlob(fieldSlot, &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);
|
jbyteArray byteArray = env->NewByteArray(size);
|
||||||
if (!byteArray) {
|
if (!byteArray) {
|
||||||
env->ExceptionClear();
|
env->ExceptionClear();
|
||||||
@@ -240,6 +244,10 @@ static jstring nativeGetString(JNIEnv* env, jclass clazz, jlong windowPtr,
|
|||||||
if (type == CursorWindow::FIELD_TYPE_STRING) {
|
if (type == CursorWindow::FIELD_TYPE_STRING) {
|
||||||
size_t sizeIncludingNull;
|
size_t sizeIncludingNull;
|
||||||
const char* value = window->getFieldSlotValueString(fieldSlot, &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) {
|
if (sizeIncludingNull <= 1) {
|
||||||
return gEmptyString;
|
return gEmptyString;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user