Bug 1514683 - Enable SQLITE_DBCONFIG_DEFENSIVE. r=mak
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 19 Dec 2018 18:11:27 +0000
changeset 451341 7408e4b312e9b21335c2ec746ae281db3ea5b7ca
parent 451340 41975e3a1543f7dd7bf4b39f05fa57b13a6571ec
child 451342 ef9d941b10a8ef56fd81ba86f43b2ac60ffbf6ac
push id35234
push userrmaries@mozilla.com
push dateWed, 19 Dec 2018 21:56:37 +0000
treeherdermozilla-central@c8d73c84dc93 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1514683
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1514683 - Enable SQLITE_DBCONFIG_DEFENSIVE. r=mak Differential Revision: https://phabricator.services.mozilla.com/D14854
db/sqlite3/src/moz.build
old-configure.in
--- a/db/sqlite3/src/moz.build
+++ b/db/sqlite3/src/moz.build
@@ -31,17 +31,17 @@ SOURCES += [
 # increases the page size from 1k, see bug 416330.  It must be kept in sync with
 # the value of PREF_TS_PAGESIZE_DEFAULT in mozStorageService.cpp.  The value can
 # be overridden on a per-platform basis through the use of the PREF_TS_PAGESIZE
 # hidden preference.  If that preference is missing or invalid then this value
 # will be used.
 # Note: Be sure to update the configure.in checks when these change!
 for var in ('SQLITE_SECURE_DELETE', 'SQLITE_THREADSAFE', 'SQLITE_CORE',
             'SQLITE_ENABLE_FTS3', 'SQLITE_ENABLE_UNLOCK_NOTIFY',
-            'SQLITE_ENABLE_DBSTAT_VTAB'):
+            'SQLITE_ENABLE_DBSTAT_VTAB', 'SQLITE_DBCONFIG_DEFENSIVE'):
     DEFINES[var] = 1
 
 DEFINES['SQLITE_DEFAULT_PAGE_SIZE'] = 32768
 DEFINES['SQLITE_MAX_DEFAULT_PAGE_SIZE'] = 32768
 
 # -DSQLITE_WIN32_GETVERSIONEX=0 avoids using deprecated functions.
 # SQLite will just assume we are running on NT kinds of Windows. That's fine
 # because we don't support Win9x.
--- a/old-configure.in
+++ b/old-configure.in
@@ -3129,16 +3129,45 @@ then
         )
     ])
     AC_MSG_RESULT($ac_cv_sqlite_dbstat_vtab)
     CFLAGS="$_SAVE_CFLAGS"
     LIBS="$_SAVE_LIBS"
     if test "x$ac_cv_sqlite_dbstat_vtab" = "xno"; then
         AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_DBSTAT_VTAB.])
     fi
+
+    dnl =========================================
+    dnl === SQLITE_DBCONFIG_DEFENSIVE check ===
+    dnl =========================================
+    dnl check to see if the system SQLite package is compiled with
+    dnl SQLITE_DBCONFIG_DEFENSIVE.
+    AC_MSG_CHECKING(for SQLITE_DBCONFIG_DEFENSIVE support in system SQLite)
+    _SAVE_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS $SQLITE_CFLAGS"
+    _SAVE_LIBS="$LIBS"
+    LIBS="$LIBS $SQLITE_LIBS"
+    AC_CACHE_VAL(ac_cv_sqlite_dbconfig_defensive,[
+        AC_TRY_RUN([
+            #include "sqlite3.h"
+
+            int main(int argc, char **argv){
+              return !sqlite3_compileoption_used("SQLITE_DBCONFIG_DEFENSIVE");
+            }],
+            ac_cv_sqlite_dbconfig_defensive=yes,
+            ac_cv_sqlite_dbconfig_defensive=no,
+            ac_cv_sqlite_dbconfig_defensive=no
+        )
+    ])
+    AC_MSG_RESULT($ac_cv_sqlite_dbconfig_defensive)
+    CFLAGS="$_SAVE_CFLAGS"
+    LIBS="$_SAVE_LIBS"
+    if test "x$ac_cv_sqlite_dbconfig_defensive" = "xno"; then
+        AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_DBCONFIG_DEFENSIVE.])
+    fi
 else
     dnl ==============================
     dnl === SQLite fdatasync check ===
     dnl ==============================
     dnl Check to see if fdatasync is available
     AC_CHECK_FUNC(fdatasync)
 fi