]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add an OOM check to the previous check-in. Minor internal API renaming.
authorstephan <stephan@noemail.net>
Fri, 28 Jul 2023 01:19:44 +0000 (01:19 +0000)
committerstephan <stephan@noemail.net>
Fri, 28 Jul 2023 01:19:44 +0000 (01:19 +0000)
FossilOrigin-Name: 6b56e4d62b4945e52978d00aa8e2984faa731c92a7e002e81524fcfcf8ba0cce

ext/jni/src/c/sqlite3-jni.c
manifest
manifest.uuid

index 907c6a9d238d25a04dd570cd2c6f3659a3639f98..fba90108d1ef6723f3291e53684548f4a8acdb99 100644 (file)
@@ -723,8 +723,10 @@ static void * getNativePointer(JNIEnv * env, jobject pObj, const char *zClassNam
    xStep() and xFinal() methods.
 
    isFinal must be 1 for xFinal() calls and 0 for all others.
+
+   Returns 0 on succes, SQLITE_NOMEM on allocation error.
 */
-static void setAggregateContext(JNIEnv * env, jobject jCx,
+static int s3jni_setAggregateContext(JNIEnv * env, jobject jCx,
                                 sqlite3_context * pCx,
                                 int isFinal){
   jmethodID setter;
@@ -745,8 +747,11 @@ static void setAggregateContext(JNIEnv * env, jobject jCx,
     }
   }
   pAgg = sqlite3_aggregate_context(pCx, isFinal ? 0 : 8);
-  (*env)->CallVoidMethod(env, jCx, setter, (jlong)pAgg);
-  IFTHREW_REPORT;
+  if( pAgg ){
+    (*env)->CallVoidMethod(env, jCx, setter, (jlong)pAgg);
+    IFTHREW_REPORT;
+  }
+  return pAgg ? (int)0 : SQLITE_NOMEM;
 }
 
 
@@ -1156,11 +1161,13 @@ static int udf_xFSI(sqlite3_context* pCx, int argc,
   if(rc) return rc;
   //MARKER(("UDF::%s.%s()\n", s->zFuncName, zFuncType));
   if( UDF_SCALAR != s->type ){
-    setAggregateContext(env, args.jcx, pCx, 0);
+    rc = s3jni_setAggregateContext(env, args.jcx, pCx, 0);
   }
-  (*env)->CallVoidMethod(env, s->jObj, xMethodID, args.jcx, args.jargv);
-  IFTHREW{
-    rc = udf_report_exception(pCx,s, zFuncType);
+  if( 0 == rc ){
+    (*env)->CallVoidMethod(env, s->jObj, xMethodID, args.jcx, args.jargv);
+    IFTHREW{
+      rc = udf_report_exception(pCx,s, zFuncType);
+    }
   }
   UNREF_L(args.jcx);
   UNREF_L(args.jargv);
@@ -1180,11 +1187,13 @@ static int udf_xFV(sqlite3_context* cx, UDFState * s,
   }
   //MARKER(("UDF::%s.%s()\n", s->zFuncName, zFuncType));
   if( UDF_SCALAR != s->type ){
-    setAggregateContext(env, jcx, cx, 1);
+    rc = s3jni_setAggregateContext(env, jcx, cx, 1);
   }
-  (*env)->CallVoidMethod(env, s->jObj, xMethodID, jcx);
-  IFTHREW{
-    rc = udf_report_exception(cx,s, zFuncType);
+  if( 0 == rc ){
+    (*env)->CallVoidMethod(env, s->jObj, xMethodID, jcx);
+    IFTHREW{
+      rc = udf_report_exception(cx,s, zFuncType);
+    }
   }
   UNREF_L(jcx);
   return rc;
index 7fe2d447fd3f2f22cbd6ee80203db915bd77c8a8..058fbe8d0901ac157e3bee21dfb870bb5e231462 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\ssupport\smaking\suse\sof\ssqlite3_aggregate_context()\s(in\sa\sroundabout\sway)\sfrom\sJava\sto\saccumulate\sstate\swithin\saggregate\sand\swindow\sUDFs.
-D 2023-07-28T01:12:47.322
+C Add\san\sOOM\scheck\sto\sthe\sprevious\scheck-in.\sMinor\sinternal\sAPI\srenaming.
+D 2023-07-28T01:19:44.606
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -232,7 +232,7 @@ F ext/icu/icu.c c074519b46baa484bb5396c7e01e051034da8884bad1a1cb7f09bbe6be3f0282
 F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a32075a8
 F ext/jni/GNUmakefile 56a014dbff9516774d895ec1ae9df0ed442765b556f79a0fc0b5bc438217200d
 F ext/jni/README.md 042762dbf047667783a5bd0aec303535140f302debfbd259c612edf856661623
-F ext/jni/src/c/sqlite3-jni.c 8d3ae5c0474548b1b95fea888227a4f617b9302a7e230bb5ff1b3735fe85fb03
+F ext/jni/src/c/sqlite3-jni.c 7e76652684c38df7c48ac3300056601202b0c45d91c5f3671725e17c3c69ec6a
 F ext/jni/src/c/sqlite3-jni.h c9bb150a38dce09cc2794d5aac8fa097288d9946fbb15250fd0a23c31957f506
 F ext/jni/src/org/sqlite/jni/BusyHandler.java 1b1d3e5c86cd796a0580c81b6af6550ad943baa25e47ada0dcca3aff3ebe978c
 F ext/jni/src/org/sqlite/jni/Collation.java 8dffbb00938007ad0967b2ab424d3c908413af1bbd3d212b9c9899910f1218d1
@@ -2067,8 +2067,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P dc356667a8f4fa31a3fef1ae35873d834d27fd6a9f0818d6fb85e4751fde9fe5
-R 6f355aed3877133b3fb6aa6671123d94
+P 640574984741c7a9472d7f8be7bce87e736d7947ce673ae4a25008d74238ad90
+R ce71c2fd0629446f06e751d7b64d5f7d
 U stephan
-Z 75e450fbcee41582218a9562a53136a5
+Z 3429cf1394e9a8e9214fcef9821d7359
 # Remove this line to create a well-formed Fossil manifest.
index c7d6c30d9979ecd81b7f42e9ff2d743b0cd6af99..b7049ce4d7c5e0c6f01407239d9bd3ad9f7053dc 100644 (file)
@@ -1 +1 @@
-640574984741c7a9472d7f8be7bce87e736d7947ce673ae4a25008d74238ad90
\ No newline at end of file
+6b56e4d62b4945e52978d00aa8e2984faa731c92a7e002e81524fcfcf8ba0cce
\ No newline at end of file