summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vasu Nori <vnori@google.com> 2011-02-25 00:26:28 -0800
committer Vasu Nori <vnori@google.com> 2011-02-25 08:56:07 -0800
commite6044145bccf30e2b1785eb33a26de6496167986 (patch)
tree891e5f76eb2c1d670c64e7e7708de6e20f7a0989
parentee4d1a67085cb6f49801f2e726df58a87e988253 (diff)
bug:3467948 if byteArray couldn't be allocated for blob, throw exception
Change-Id: I73e36c10f31086ea567debad536350316b2df67f
-rw-r--r--core/jni/android_database_CursorWindow.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/jni/android_database_CursorWindow.cpp b/core/jni/android_database_CursorWindow.cpp
index a4281515f0d9..ddac82063e80 100644
--- a/core/jni/android_database_CursorWindow.cpp
+++ b/core/jni/android_database_CursorWindow.cpp
@@ -208,7 +208,10 @@ LOG_WINDOW("Getting blob for %d,%d from %p", row, column, window);
uint8_t type = field.type;
if (type == FIELD_TYPE_BLOB || type == FIELD_TYPE_STRING) {
jbyteArray byteArray = env->NewByteArray(field.data.buffer.size);
- LOG_ASSERT(byteArray, "Native could not create new byte[]");
+ if (!byteArray) {
+ throw_sqlite3_exception(env, "Native could not create new byte[]");
+ return NULL;
+ }
env->SetByteArrayRegion(byteArray, 0, field.data.buffer.size,
(const jbyte*)window->offsetToPtr(field.data.buffer.offset));
return byteArray;