/ Check-in [1da302d8]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge latest trunk changes into this branch.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dbdata
Files: files | file ages | folders
SHA3-256: 1da302d85d7ad4ba54f877117a45d667439fd2ef31dc70ea1d54dc1fba196e68
User & Date: dan 2019-04-25 20:06:34
Context
2019-04-26
15:14
Fix a locking-page related problem with the ".recover" command. check-in: afdae104 user: dan tags: dbdata
2019-04-25
20:06
Merge latest trunk changes into this branch. check-in: 1da302d8 user: dan tags: dbdata
19:23
Unless the "--freelist-corrupt" option is specified, do not have the .recover command attempt to recover data from pages that are on the database free-list. check-in: 8d2f52bb user: dan tags: dbdata
2019-04-24
17:04
New test cases in test/fuzzdata8.db. check-in: 7be6222c user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to VERSION.

     1         -3.28.0
            1  +3.29.0

Changes to configure.

     1      1   #! /bin/sh
     2      2   # Guess values for system-dependent variables and create Makefiles.
     3         -# Generated by GNU Autoconf 2.69 for sqlite 3.28.0.
            3  +# Generated by GNU Autoconf 2.69 for sqlite 3.29.0.
     4      4   #
     5      5   #
     6      6   # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
     7      7   #
     8      8   #
     9      9   # This configure script is free software; the Free Software Foundation
    10     10   # gives unlimited permission to copy, distribute and modify it.
................................................................................
   722    722   subdirs=
   723    723   MFLAGS=
   724    724   MAKEFLAGS=
   725    725   
   726    726   # Identity of this package.
   727    727   PACKAGE_NAME='sqlite'
   728    728   PACKAGE_TARNAME='sqlite'
   729         -PACKAGE_VERSION='3.28.0'
   730         -PACKAGE_STRING='sqlite 3.28.0'
          729  +PACKAGE_VERSION='3.29.0'
          730  +PACKAGE_STRING='sqlite 3.29.0'
   731    731   PACKAGE_BUGREPORT=''
   732    732   PACKAGE_URL=''
   733    733   
   734    734   # Factoring default headers for most tests.
   735    735   ac_includes_default="\
   736    736   #include <stdio.h>
   737    737   #ifdef HAVE_SYS_TYPES_H
................................................................................
   859    859   pdfdir
   860    860   dvidir
   861    861   htmldir
   862    862   infodir
   863    863   docdir
   864    864   oldincludedir
   865    865   includedir
   866         -runstatedir
   867    866   localstatedir
   868    867   sharedstatedir
   869    868   sysconfdir
   870    869   datadir
   871    870   datarootdir
   872    871   libexecdir
   873    872   sbindir
................................................................................
   961    960   sbindir='${exec_prefix}/sbin'
   962    961   libexecdir='${exec_prefix}/libexec'
   963    962   datarootdir='${prefix}/share'
   964    963   datadir='${datarootdir}'
   965    964   sysconfdir='${prefix}/etc'
   966    965   sharedstatedir='${prefix}/com'
   967    966   localstatedir='${prefix}/var'
   968         -runstatedir='${localstatedir}/run'
   969    967   includedir='${prefix}/include'
   970    968   oldincludedir='/usr/include'
   971    969   docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
   972    970   infodir='${datarootdir}/info'
   973    971   htmldir='${docdir}'
   974    972   dvidir='${docdir}'
   975    973   pdfdir='${docdir}'
................................................................................
  1214   1212     -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
  1215   1213       psdir=$ac_optarg ;;
  1216   1214   
  1217   1215     -q | -quiet | --quiet | --quie | --qui | --qu | --q \
  1218   1216     | -silent | --silent | --silen | --sile | --sil)
  1219   1217       silent=yes ;;
  1220   1218   
  1221         -  -runstatedir | --runstatedir | --runstatedi | --runstated \
  1222         -  | --runstate | --runstat | --runsta | --runst | --runs \
  1223         -  | --run | --ru | --r)
  1224         -    ac_prev=runstatedir ;;
  1225         -  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
  1226         -  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
  1227         -  | --run=* | --ru=* | --r=*)
  1228         -    runstatedir=$ac_optarg ;;
  1229         -
  1230   1219     -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
  1231   1220       ac_prev=sbindir ;;
  1232   1221     -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
  1233   1222     | --sbi=* | --sb=*)
  1234   1223       sbindir=$ac_optarg ;;
  1235   1224   
  1236   1225     -sharedstatedir | --sharedstatedir | --sharedstatedi \
................................................................................
  1360   1349     esac
  1361   1350   fi
  1362   1351   
  1363   1352   # Check all directory arguments for consistency.
  1364   1353   for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
  1365   1354   		datadir sysconfdir sharedstatedir localstatedir includedir \
  1366   1355   		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
  1367         -		libdir localedir mandir runstatedir
         1356  +		libdir localedir mandir
  1368   1357   do
  1369   1358     eval ac_val=\$$ac_var
  1370   1359     # Remove trailing slashes.
  1371   1360     case $ac_val in
  1372   1361       */ )
  1373   1362         ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
  1374   1363         eval $ac_var=\$ac_val;;
................................................................................
  1473   1462   #
  1474   1463   # Report the --help message.
  1475   1464   #
  1476   1465   if test "$ac_init_help" = "long"; then
  1477   1466     # Omit some internal or obsolete options to make the list less imposing.
  1478   1467     # This message is too long to be a string in the A/UX 3.1 sh.
  1479   1468     cat <<_ACEOF
  1480         -\`configure' configures sqlite 3.28.0 to adapt to many kinds of systems.
         1469  +\`configure' configures sqlite 3.29.0 to adapt to many kinds of systems.
  1481   1470   
  1482   1471   Usage: $0 [OPTION]... [VAR=VALUE]...
  1483   1472   
  1484   1473   To assign environment variables (e.g., CC, CFLAGS...), specify them as
  1485   1474   VAR=VALUE.  See below for descriptions of some of the useful variables.
  1486   1475   
  1487   1476   Defaults for the options are specified in brackets.
................................................................................
  1513   1502   Fine tuning of the installation directories:
  1514   1503     --bindir=DIR            user executables [EPREFIX/bin]
  1515   1504     --sbindir=DIR           system admin executables [EPREFIX/sbin]
  1516   1505     --libexecdir=DIR        program executables [EPREFIX/libexec]
  1517   1506     --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
  1518   1507     --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
  1519   1508     --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
  1520         -  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
  1521   1509     --libdir=DIR            object code libraries [EPREFIX/lib]
  1522   1510     --includedir=DIR        C header files [PREFIX/include]
  1523   1511     --oldincludedir=DIR     C header files for non-gcc [/usr/include]
  1524   1512     --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
  1525   1513     --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
  1526   1514     --infodir=DIR           info documentation [DATAROOTDIR/info]
  1527   1515     --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
................................................................................
  1539   1527     --build=BUILD     configure for building on BUILD [guessed]
  1540   1528     --host=HOST       cross-compile to build programs to run on HOST [BUILD]
  1541   1529   _ACEOF
  1542   1530   fi
  1543   1531   
  1544   1532   if test -n "$ac_init_help"; then
  1545   1533     case $ac_init_help in
  1546         -     short | recursive ) echo "Configuration of sqlite 3.28.0:";;
         1534  +     short | recursive ) echo "Configuration of sqlite 3.29.0:";;
  1547   1535      esac
  1548   1536     cat <<\_ACEOF
  1549   1537   
  1550   1538   Optional Features:
  1551   1539     --disable-option-checking  ignore unrecognized --enable/--with options
  1552   1540     --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  1553   1541     --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
................................................................................
  1665   1653       cd "$ac_pwd" || { ac_status=$?; break; }
  1666   1654     done
  1667   1655   fi
  1668   1656   
  1669   1657   test -n "$ac_init_help" && exit $ac_status
  1670   1658   if $ac_init_version; then
  1671   1659     cat <<\_ACEOF
  1672         -sqlite configure 3.28.0
         1660  +sqlite configure 3.29.0
  1673   1661   generated by GNU Autoconf 2.69
  1674   1662   
  1675   1663   Copyright (C) 2012 Free Software Foundation, Inc.
  1676   1664   This configure script is free software; the Free Software Foundation
  1677   1665   gives unlimited permission to copy, distribute and modify it.
  1678   1666   _ACEOF
  1679   1667     exit
................................................................................
  2084   2072     eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
  2085   2073   
  2086   2074   } # ac_fn_c_check_header_mongrel
  2087   2075   cat >config.log <<_ACEOF
  2088   2076   This file contains any messages produced by compilers while
  2089   2077   running configure, to aid debugging if configure makes a mistake.
  2090   2078   
  2091         -It was created by sqlite $as_me 3.28.0, which was
         2079  +It was created by sqlite $as_me 3.29.0, which was
  2092   2080   generated by GNU Autoconf 2.69.  Invocation command line was
  2093   2081   
  2094   2082     $ $0 $@
  2095   2083   
  2096   2084   _ACEOF
  2097   2085   exec 5>>config.log
  2098   2086   {
................................................................................
  3942   3930   { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
  3943   3931   $as_echo_n "checking the name lister ($NM) interface... " >&6; }
  3944   3932   if ${lt_cv_nm_interface+:} false; then :
  3945   3933     $as_echo_n "(cached) " >&6
  3946   3934   else
  3947   3935     lt_cv_nm_interface="BSD nm"
  3948   3936     echo "int some_variable = 0;" > conftest.$ac_ext
  3949         -  (eval echo "\"\$as_me:3949: $ac_compile\"" >&5)
         3937  +  (eval echo "\"\$as_me:3937: $ac_compile\"" >&5)
  3950   3938     (eval "$ac_compile" 2>conftest.err)
  3951   3939     cat conftest.err >&5
  3952         -  (eval echo "\"\$as_me:3952: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
         3940  +  (eval echo "\"\$as_me:3940: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
  3953   3941     (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
  3954   3942     cat conftest.err >&5
  3955         -  (eval echo "\"\$as_me:3955: output\"" >&5)
         3943  +  (eval echo "\"\$as_me:3943: output\"" >&5)
  3956   3944     cat conftest.out >&5
  3957   3945     if $GREP 'External.*some_variable' conftest.out > /dev/null; then
  3958   3946       lt_cv_nm_interface="MS dumpbin"
  3959   3947     fi
  3960   3948     rm -f conftest*
  3961   3949   fi
  3962   3950   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
................................................................................
  5154   5142   	;;
  5155   5143       esac
  5156   5144     fi
  5157   5145     rm -rf conftest*
  5158   5146     ;;
  5159   5147   *-*-irix6*)
  5160   5148     # Find out which ABI we are using.
  5161         -  echo '#line 5161 "configure"' > conftest.$ac_ext
         5149  +  echo '#line 5149 "configure"' > conftest.$ac_ext
  5162   5150     if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
  5163   5151     (eval $ac_compile) 2>&5
  5164   5152     ac_status=$?
  5165   5153     $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  5166   5154     test $ac_status = 0; }; then
  5167   5155       if test "$lt_cv_prog_gnu_ld" = yes; then
  5168   5156         case `/usr/bin/file conftest.$ac_objext` in
................................................................................
  6679   6667      # Note that $ac_compile itself does not contain backslashes and begins
  6680   6668      # with a dollar sign (not a hyphen), so the echo should work correctly.
  6681   6669      # The option is referenced via a variable to avoid confusing sed.
  6682   6670      lt_compile=`echo "$ac_compile" | $SED \
  6683   6671      -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
  6684   6672      -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
  6685   6673      -e 's:$: $lt_compiler_flag:'`
  6686         -   (eval echo "\"\$as_me:6686: $lt_compile\"" >&5)
         6674  +   (eval echo "\"\$as_me:6674: $lt_compile\"" >&5)
  6687   6675      (eval "$lt_compile" 2>conftest.err)
  6688   6676      ac_status=$?
  6689   6677      cat conftest.err >&5
  6690         -   echo "$as_me:6690: \$? = $ac_status" >&5
         6678  +   echo "$as_me:6678: \$? = $ac_status" >&5
  6691   6679      if (exit $ac_status) && test -s "$ac_outfile"; then
  6692   6680        # The compiler can only warn and ignore the option if not recognized
  6693   6681        # So say no if there are warnings other than the usual output.
  6694   6682        $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
  6695   6683        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
  6696   6684        if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
  6697   6685          lt_cv_prog_compiler_rtti_exceptions=yes
................................................................................
  7018   7006      # Note that $ac_compile itself does not contain backslashes and begins
  7019   7007      # with a dollar sign (not a hyphen), so the echo should work correctly.
  7020   7008      # The option is referenced via a variable to avoid confusing sed.
  7021   7009      lt_compile=`echo "$ac_compile" | $SED \
  7022   7010      -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
  7023   7011      -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
  7024   7012      -e 's:$: $lt_compiler_flag:'`
  7025         -   (eval echo "\"\$as_me:7025: $lt_compile\"" >&5)
         7013  +   (eval echo "\"\$as_me:7013: $lt_compile\"" >&5)
  7026   7014      (eval "$lt_compile" 2>conftest.err)
  7027   7015      ac_status=$?
  7028   7016      cat conftest.err >&5
  7029         -   echo "$as_me:7029: \$? = $ac_status" >&5
         7017  +   echo "$as_me:7017: \$? = $ac_status" >&5
  7030   7018      if (exit $ac_status) && test -s "$ac_outfile"; then
  7031   7019        # The compiler can only warn and ignore the option if not recognized
  7032   7020        # So say no if there are warnings other than the usual output.
  7033   7021        $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
  7034   7022        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
  7035   7023        if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
  7036   7024          lt_cv_prog_compiler_pic_works=yes
................................................................................
  7123   7111      # (2) before a word containing "conftest.", or (3) at the end.
  7124   7112      # Note that $ac_compile itself does not contain backslashes and begins
  7125   7113      # with a dollar sign (not a hyphen), so the echo should work correctly.
  7126   7114      lt_compile=`echo "$ac_compile" | $SED \
  7127   7115      -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
  7128   7116      -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
  7129   7117      -e 's:$: $lt_compiler_flag:'`
  7130         -   (eval echo "\"\$as_me:7130: $lt_compile\"" >&5)
         7118  +   (eval echo "\"\$as_me:7118: $lt_compile\"" >&5)
  7131   7119      (eval "$lt_compile" 2>out/conftest.err)
  7132   7120      ac_status=$?
  7133   7121      cat out/conftest.err >&5
  7134         -   echo "$as_me:7134: \$? = $ac_status" >&5
         7122  +   echo "$as_me:7122: \$? = $ac_status" >&5
  7135   7123      if (exit $ac_status) && test -s out/conftest2.$ac_objext
  7136   7124      then
  7137   7125        # The compiler can only warn and ignore the option if not recognized
  7138   7126        # So say no if there are warnings
  7139   7127        $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
  7140   7128        $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
  7141   7129        if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
................................................................................
  7178   7166      # (2) before a word containing "conftest.", or (3) at the end.
  7179   7167      # Note that $ac_compile itself does not contain backslashes and begins
  7180   7168      # with a dollar sign (not a hyphen), so the echo should work correctly.
  7181   7169      lt_compile=`echo "$ac_compile" | $SED \
  7182   7170      -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
  7183   7171      -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
  7184   7172      -e 's:$: $lt_compiler_flag:'`
  7185         -   (eval echo "\"\$as_me:7185: $lt_compile\"" >&5)
         7173  +   (eval echo "\"\$as_me:7173: $lt_compile\"" >&5)
  7186   7174      (eval "$lt_compile" 2>out/conftest.err)
  7187   7175      ac_status=$?
  7188   7176      cat out/conftest.err >&5
  7189         -   echo "$as_me:7189: \$? = $ac_status" >&5
         7177  +   echo "$as_me:7177: \$? = $ac_status" >&5
  7190   7178      if (exit $ac_status) && test -s out/conftest2.$ac_objext
  7191   7179      then
  7192   7180        # The compiler can only warn and ignore the option if not recognized
  7193   7181        # So say no if there are warnings
  7194   7182        $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
  7195   7183        $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
  7196   7184        if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
................................................................................
  9558   9546   else
  9559   9547     	  if test "$cross_compiling" = yes; then :
  9560   9548     lt_cv_dlopen_self=cross
  9561   9549   else
  9562   9550     lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
  9563   9551     lt_status=$lt_dlunknown
  9564   9552     cat > conftest.$ac_ext <<_LT_EOF
  9565         -#line 9565 "configure"
         9553  +#line 9553 "configure"
  9566   9554   #include "confdefs.h"
  9567   9555   
  9568   9556   #if HAVE_DLFCN_H
  9569   9557   #include <dlfcn.h>
  9570   9558   #endif
  9571   9559   
  9572   9560   #include <stdio.h>
................................................................................
  9654   9642   else
  9655   9643     	  if test "$cross_compiling" = yes; then :
  9656   9644     lt_cv_dlopen_self_static=cross
  9657   9645   else
  9658   9646     lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
  9659   9647     lt_status=$lt_dlunknown
  9660   9648     cat > conftest.$ac_ext <<_LT_EOF
  9661         -#line 9661 "configure"
         9649  +#line 9649 "configure"
  9662   9650   #include "confdefs.h"
  9663   9651   
  9664   9652   #if HAVE_DLFCN_H
  9665   9653   #include <dlfcn.h>
  9666   9654   #endif
  9667   9655   
  9668   9656   #include <stdio.h>
................................................................................
 10003   9991   	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 10004   9992   /* end confdefs.h.  */
 10005   9993   #include <sys/types.h>
 10006   9994    /* Check that off_t can represent 2**63 - 1 correctly.
 10007   9995       We can't simply define LARGE_OFF_T to be 9223372036854775807,
 10008   9996       since some C++ compilers masquerading as C compilers
 10009   9997       incorrectly reject 9223372036854775807.  */
 10010         -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
         9998  +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
 10011   9999     int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 10012  10000   		       && LARGE_OFF_T % 2147483647 == 1)
 10013  10001   		      ? 1 : -1];
 10014  10002   int
 10015  10003   main ()
 10016  10004   {
 10017  10005   
................................................................................
 10049  10037     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 10050  10038   /* end confdefs.h.  */
 10051  10039   #include <sys/types.h>
 10052  10040    /* Check that off_t can represent 2**63 - 1 correctly.
 10053  10041       We can't simply define LARGE_OFF_T to be 9223372036854775807,
 10054  10042       since some C++ compilers masquerading as C compilers
 10055  10043       incorrectly reject 9223372036854775807.  */
 10056         -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
        10044  +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
 10057  10045     int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 10058  10046   		       && LARGE_OFF_T % 2147483647 == 1)
 10059  10047   		      ? 1 : -1];
 10060  10048   int
 10061  10049   main ()
 10062  10050   {
 10063  10051   
................................................................................
 10073  10061   /* end confdefs.h.  */
 10074  10062   #define _FILE_OFFSET_BITS 64
 10075  10063   #include <sys/types.h>
 10076  10064    /* Check that off_t can represent 2**63 - 1 correctly.
 10077  10065       We can't simply define LARGE_OFF_T to be 9223372036854775807,
 10078  10066       since some C++ compilers masquerading as C compilers
 10079  10067       incorrectly reject 9223372036854775807.  */
 10080         -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
        10068  +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
 10081  10069     int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 10082  10070   		       && LARGE_OFF_T % 2147483647 == 1)
 10083  10071   		      ? 1 : -1];
 10084  10072   int
 10085  10073   main ()
 10086  10074   {
 10087  10075   
................................................................................
 10118  10106     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 10119  10107   /* end confdefs.h.  */
 10120  10108   #include <sys/types.h>
 10121  10109    /* Check that off_t can represent 2**63 - 1 correctly.
 10122  10110       We can't simply define LARGE_OFF_T to be 9223372036854775807,
 10123  10111       since some C++ compilers masquerading as C compilers
 10124  10112       incorrectly reject 9223372036854775807.  */
 10125         -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
        10113  +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
 10126  10114     int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 10127  10115   		       && LARGE_OFF_T % 2147483647 == 1)
 10128  10116   		      ? 1 : -1];
 10129  10117   int
 10130  10118   main ()
 10131  10119   {
 10132  10120   
................................................................................
 10142  10130   /* end confdefs.h.  */
 10143  10131   #define _LARGE_FILES 1
 10144  10132   #include <sys/types.h>
 10145  10133    /* Check that off_t can represent 2**63 - 1 correctly.
 10146  10134       We can't simply define LARGE_OFF_T to be 9223372036854775807,
 10147  10135       since some C++ compilers masquerading as C compilers
 10148  10136       incorrectly reject 9223372036854775807.  */
 10149         -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
        10137  +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
 10150  10138     int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 10151  10139   		       && LARGE_OFF_T % 2147483647 == 1)
 10152  10140   		      ? 1 : -1];
 10153  10141   int
 10154  10142   main ()
 10155  10143   {
 10156  10144   
................................................................................
 12240  12228   test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
 12241  12229   
 12242  12230   cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 12243  12231   # Save the log message, to keep $0 and so on meaningful, and to
 12244  12232   # report actual input values of CONFIG_FILES etc. instead of their
 12245  12233   # values after options handling.
 12246  12234   ac_log="
 12247         -This file was extended by sqlite $as_me 3.28.0, which was
        12235  +This file was extended by sqlite $as_me 3.29.0, which was
 12248  12236   generated by GNU Autoconf 2.69.  Invocation command line was
 12249  12237   
 12250  12238     CONFIG_FILES    = $CONFIG_FILES
 12251  12239     CONFIG_HEADERS  = $CONFIG_HEADERS
 12252  12240     CONFIG_LINKS    = $CONFIG_LINKS
 12253  12241     CONFIG_COMMANDS = $CONFIG_COMMANDS
 12254  12242     $ $0 $@
................................................................................
 12306  12294   
 12307  12295   Report bugs to the package provider."
 12308  12296   
 12309  12297   _ACEOF
 12310  12298   cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 12311  12299   ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 12312  12300   ac_cs_version="\\
 12313         -sqlite config.status 3.28.0
        12301  +sqlite config.status 3.29.0
 12314  12302   configured by $0, generated by GNU Autoconf 2.69,
 12315  12303     with options \\"\$ac_cs_config\\"
 12316  12304   
 12317  12305   Copyright (C) 2012 Free Software Foundation, Inc.
 12318  12306   This config.status script is free software; the Free Software Foundation
 12319  12307   gives unlimited permission to copy, distribute and modify it."
 12320  12308   

Changes to ext/fts3/fts3_write.c.

  3750   3750       p->aNode = 0;
  3751   3751     }else{
  3752   3752       if( bFirst==0 ){
  3753   3753         p->iOff += fts3GetVarint32(&p->aNode[p->iOff], &nPrefix);
  3754   3754       }
  3755   3755       p->iOff += fts3GetVarint32(&p->aNode[p->iOff], &nSuffix);
  3756   3756   
  3757         -    if( nPrefix>p->iOff || nSuffix>p->nNode-p->iOff ){
         3757  +    if( nPrefix>p->term.n || nSuffix>p->nNode-p->iOff || nSuffix==0 ){
  3758   3758         return FTS_CORRUPT_VTAB;
  3759   3759       }
  3760   3760       blobGrowBuffer(&p->term, nPrefix+nSuffix, &rc);
  3761   3761       if( rc==SQLITE_OK ){
  3762   3762         memcpy(&p->term.a[nPrefix], &p->aNode[p->iOff], nSuffix);
  3763   3763         p->term.n = nPrefix+nSuffix;
  3764   3764         p->iOff += nSuffix;
................................................................................
  3769   3769           }
  3770   3770           p->aDoclist = &p->aNode[p->iOff];
  3771   3771           p->iOff += p->nDoclist;
  3772   3772         }
  3773   3773       }
  3774   3774     }
  3775   3775   
  3776         -  assert( p->iOff<=p->nNode );
         3776  +  assert_fts3_nc( p->iOff<=p->nNode );
  3777   3777     return rc;
  3778   3778   }
  3779   3779   
  3780   3780   /*
  3781   3781   ** Release all dynamic resources held by node-reader object *p.
  3782   3782   */
  3783   3783   static void nodeReaderRelease(NodeReader *p){

Changes to ext/fts5/fts5_buffer.c.

   174    174       /* EOF */
   175    175       *piOff = -1;
   176    176       return 1;  
   177    177     }else{
   178    178       i64 iOff = *piOff;
   179    179       int iVal;
   180    180       fts5FastGetVarint32(a, i, iVal);
   181         -    if( iVal==1 ){
          181  +    if( iVal<=1 ){
          182  +      if( iVal==0 ){
          183  +        *pi = i;
          184  +        return 0;
          185  +      }
   182    186         fts5FastGetVarint32(a, i, iVal);
   183    187         iOff = ((i64)iVal) << 32;
   184    188         fts5FastGetVarint32(a, i, iVal);
   185    189       }
   186    190       *piOff = iOff + ((iVal-2) & 0x7FFFFFFF);
   187    191       *pi = i;
   188    192       return 0;

Changes to ext/fts5/test/fts5corrupt3.test.

  8124   8124   | end x.db
  8125   8125   }]} {}
  8126   8126   
  8127   8127   do_catchsql_test 57.1 {
  8128   8128     INSERT INTO t1(t1) VALUES('optimize')
  8129   8129   } {1 {database disk image is malformed}}
  8130   8130   
         8131  +#-------------------------------------------------------------------------
         8132  +reset_db
         8133  +do_test 58.0 {
         8134  +  sqlite3 db {}
         8135  +  db deserialize [decode_hexdb {
         8136  +.open --hexdb
         8137  +| size 24576 pagesize 4096 filename crash-5a5acd0ab42d31.db
         8138  +| page 1 offset 0
         8139  +|      0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00   SQLite format 3.
         8140  +|     16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 00   .....@  ........
         8141  +|     96: 00 00 00 00 0d 00 00 00 06 0e 0f 00 0f aa 0f 53   ...............S
         8142  +|    112: 0e e8 0e 8b 0e 33 0e 0f 00 00 00 00 00 00 00 00   .....3..........
         8143  +|   3584: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 22   ................
         8144  +|   3600: 06 06 17 11 11 01 31 74 61 62 6c 65 62 62 62 62   ......1tablebbbb
         8145  +|   3616: 06 43 52 45 41 54 45 20 54 41 42 4c 45 20 62 62   .CREATE TABLE bb
         8146  +|   3632: 28 61 29 56 05 06 17 1f 1f 01 7d 74 61 62 6c 65   (a)V.......table
         8147  +|   3648: 74 31 5f 63 2a 6e 66 69 68 74 31 5f 63 6f 6e 66   t1_c*nfiht1_conf
         8148  +|   3664: 69 67 05 43 52 45 41 54 45 20 54 41 42 4c 45 20   ig.CREATE TABLE 
         8149  +|   3680: 27 74 31 5f 63 6f 6e 66 69 67 27 28 6b 20 50 52   't1_config'(k PR
         8150  +|   3696: 49 4d 41 52 59 20 4b 45 59 2c 20 76 29 20 57 49   IMARY KEY, v) WI
         8151  +|   3712: 54 48 4f 55 54 20 52 4f 57 49 44 5b 04 07 17 21   THOUT ROWID[...!
         8152  +|   3728: 21 01 81 01 74 61 62 6c 65 74 31 5f 64 6f 73 73   !...tablet1_doss
         8153  +|   3744: 69 7a 65 74 31 5f 64 6f 63 73 69 7a 65 04 43 52   izet1_docsize.CR
         8154  +|   3760: 45 41 54 45 20 54 41 42 4c 45 20 27 74 31 5f 64   EATE TABLE 't1_d
         8155  +|   3776: 6f 63 73 69 7a 65 27 28 69 64 20 49 4e 54 45 47   ocsize'(id INTEG
         8156  +|   3792: 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 20   ER PRIMARY KEY, 
         8157  +|   3808: 73 7a 20 42 4c 4f 42 29 69 03 07 17 19 19 01 81   sz BLOB)i.......
         8158  +|   3824: 2d 74 61 62 6c 65 74 31 5f 69 64 78 74 31 5f 69   -tablet1_idxt1_i
         8159  +|   3840: 64 78 03 43 52 45 41 54 45 20 54 41 42 4c 45 20   dx.CREATE TABLE 
         8160  +|   3856: 27 74 31 5f 69 64 78 27 28 73 65 67 69 64 2c 20   't1_idx'(segid, 
         8161  +|   3872: 74 65 72 6d 2c 20 70 67 6e 6f 2c 20 50 52 49 4d   term, pgno, PRIM
         8162  +|   3888: 41 52 59 20 4b 45 59 28 73 65 67 69 64 2c 20 74   ARY KEY(segid, t
         8163  +|   3904: 65 72 6d 29 29 20 57 49 54 48 4f 55 54 20 52 4f   erm)) WITHOUT RO
         8164  +|   3920: 57 49 44 55 02 07 17 1b 1b 01 81 01 74 61 62 6c   WIDU........tabl
         8165  +|   3936: 65 74 31 5f 64 61 74 61 74 31 5f 64 61 74 61 02   et1_datat1_data.
         8166  +|   3952: 43 52 45 41 54 45 20 54 41 42 4c 45 20 27 74 31   CREATE TABLE 't1
         8167  +|   3968: 5f 64 61 74 61 27 28 69 64 20 49 4e 54 45 47 45   _data'(id INTEGE
         8168  +|   3984: 52 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 20 62   R PRIMARY KEY, b
         8169  +|   4000: 6c 6f 63 6b 20 42 4c 4f 42 29 54 01 07 17 11 11   lock BLOB)T.....
         8170  +|   4016: 08 81 15 74 61 62 6c 65 74 31 74 31 43 52 45 41   ...tablet1t1CREA
         8171  +|   4032: 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 4c 45   TE VIRTUAL TABLE
         8172  +|   4048: 20 74 31 20 55 53 49 4e 47 20 66 74 73 35 28 61    t1 USING fts5(a
         8173  +|   4064: 2c 62 2c 70 72 65 66 69 78 3d 22 32 2c 32 2c 33   ,b,prefix=.2,2,3
         8174  +|   4080: 2c 34 22 2c 20 63 6f 6e 74 65 6e 74 3d 22 22 29   ,4., content=..)
         8175  +| page 2 offset 4096
         8176  +|      0: 0d 0b 6a 00 37 09 4c 02 0f e7 09 4c 0f c6 0f a4   ..j.7.L....L....
         8177  +|     16: 0f 88 0f 6d 0f 4b 0f 2c 0f 0e 0e ec 0e cd 0e ae   ...m.K.,........
         8178  +|     32: 0e 8e 0e 6c 0e 4b 0e 29 0e 08 0d e6 0d c4 0d b5   ...l.K.)........
         8179  +|     48: 0d 97 0d 76 0d 54 0d 30 fd 15 0c f3 0c d3 0c b5   ...v.T.0........
         8180  +|     64: 0c 95 0c 73 0c 54 0c 32 0c 10 0b ee 0b cc 0b b0   ...s.T.2........
         8181  +|     80: 0b 8d 0b 7e 0b 48 0b 2e 0b 0b 0a ef 0a cc 0a ad   ...~.H..........
         8182  +|     96: 0a 8c 0a 6d 0a 4d 0a 2b 0a 0c 00 00 00 00 00 00   ...m.M.+........
         8183  +|   2368: 00 00 00 00 00 00 00 00 00 00 00 00 15 0a 03 00   ................
         8184  +|   2384: 30 00 00 00 9c 01 03 35 00 03 01 01 12 02 01 12   0......5........
         8185  +|   2400: 03 01 11 1c 8c 80 80 80 80 10 03 00 3e 00 00 00   ............>...
         8186  +|   2416: 17 01 05 05 34 74 61 62 6c 03 02 03 01 04 77 68   ....4tabl.....wh
         8187  +|   2432: 65 72 03 02 06 09 1b 8c 80 80 80 80 0f 03 00 3c   er.............<
         8188  +|   2448: 00 00 00 16 05 34 66 74 73 34 03 02 02 01 04 6e   .....4fts4.....n
         8189  +|   2464: 75 6d 62 03 06 01 04 09 1b 8c 80 80 80 80 0e 03   umb.............
         8190  +|   2480: 00 3c 00 00 00 16 04 33 74 68 65 03 06 01 01 04   .<.....3the.....
         8191  +|   2496: 01 03 77 68 65 03 02 04 04 0a 1b 8c 80 80 80 80   ..whe...........
         8192  +|   2512: 0d 03 00 3c 00 00 00 16 04 33 6e 75 6d 03 06 01   ...<.....3num...
         8193  +|   2528: 01 05 01 03 74 61 62 05 62 03 04 0a 19 8c 80 80   ....tab.b.......
         8194  +|   2544: 80 80 0c 03 00 38 00 00 00 14 03 39 a7 68 03 02   .....8.....9.h..
         8195  +|   2560: 04 10 04 33 66 74 73 03 02 02 04 07 18 8c 80 80   ...3fts.........
         8196  +|   2576: 80 80 0b 03 00 36 00 00 00 13 03 32 74 61 03 02   .....6.....2ta..
         8197  +|   2592: 03 02 01 68 03 06 01 01 04 04 07 1b 8c 80 80 80   ...h............
         8198  +|   2608: 80 0a 03 00 3c 00 00 00 16 03 32 6e 75 03 06 01   ....<.....2nu...
         8199  +|   2624: 01 05 01 02 6f 66 03 06 01 01 06 04 09 19 8c 80   ....of..........
         8200  +|   2640: 80 80 80 09 03 00 38 00 00 00 14 03 32 66 74 03   ......8.....2ft.
         8201  +|   2656: 02 02 01 02 69 73 03 06 01 01 03 04 07 18 8c 80   ....is..........
         8202  +|   2672: 80 80 80 08 03 00 36 00 00 00 13 02 31 74 03 08   ......6.....1t..
         8203  +|   2688: 03 01 01 04 01 01 77 03 02 04 04 09 1a 8c 80 80   ......w.........
         8204  +|   2704: 80 80 07 03 00 3a ff 00 00 15 02 31 6e 03 08 01   .....:.....1n...
         8205  +|   2720: 01 02 05 01 01 6f 03 06 01 01 06 04 09 18 8c 80   .....o..........
         8206  +|   2736: 80 80 80 06 03 00 36 00 00 00 13 04 02 31 66 03   ......6......1f.
         8207  +|   2752: 02 01 f1 01 69 03 06 01 01 03 05 06 1c 8c 80 80   ....i...........
         8208  +|   2768: 80 80 05 03 00 3e 00 00 00 17 04 30 74 68 65 03   .....>.....0the.
         8209  +|   2784: 06 01 01 14 01 05 77 68 65 72 65 03 02 04 0a 15   ......where.....
         8210  +|   2800: 8c 80 80 80 80 04 03 00 30 00 00 00 11 01 01 06   ........0.......
         8211  +|   2816: 06 30 74 61 62 6c cc 03 02 03 07 1c 8c 80 80 80   .0tabl..........
         8212  +|   2832: 80 03 03 00 3e 00 00 00 17 07 30 6e 75 6d 62 65   ....>.....0numbe
         8213  +|   2848: 72 03 06 01 01 05 01 02 6f 66 02 06 04 0d 13 8c   r.......of......
         8214  +|   2864: 80 80 80 80 02 03 00 2c 00 00 00 0f 01 01 03 02   .......,........
         8215  +|   2880: 30 6e 03 06 01 01 02 07 1b 8c 80 80 80 80 01 03   0n..............
         8216  +|   2896: 00 3c 00 00 00 16 08 30 66 74 73 34 61 75 78 03   .<.....0fts4aux.
         8217  +|   2912: 02 02 01 02 69 73 03 06 04 0c 00 00 00 14 2a 00   ....is........*.
         8218  +|   2928: 00 00 01 01 02 24 00 02 01 01 12 02 01 12 08 88   .....$..........
         8219  +|   2944: 80 80 80 80 12 03 00 16 00 00 00 05 02 1c 88 80   ................
         8220  +|   2960: 80 80 80 11 03 00 3e 00 00 00 17 05 34 72 6f 77   ......>.....4row
         8221  +|   2976: 73 02 06 01 01 05 01 04 74 68 65 72 02 02 04 0b   s.......ther....
         8222  +|   2992: 15 88 80 80 80 80 10 03 00 3e 10 00 00 11 02 01   .........>......
         8223  +|   3008: 01 07 05 34 62 65 74 77 02 02 04 08 1b 88 80 80   ...4betw........
         8224  +|   3024: 80 80 0f 03 00 3c 00 00 00 16 04 04 33 72 6f 77   .....<......3row
         8225  +|   3040: 02 06 01 01 05 01 03 74 68 65 02 08 05 0a 1b 88   .......the......
         8226  +|   3056: 80 80 80 80 0e 03 05 0c 00 00 00 16 01 01 02 04   ................
         8227  +|   3072: 33 61 72 65 02 02 03 01 03 62 65 74 02 02 07 08   3are.....bet....
         8228  +|   3088: 1b 88 80 80 80 80 0d 03 00 3c 00 00 00 16 03 32   .........<.....2
         8229  +|   3104: 74 68 02 08 02 01 01 07 00 04 33 61 6e 64 02 06   th........3and..
         8230  +|   3120: 04 01 1b 88 80 80 80 80 0c 03 00 3c 00 00 00 16   ...........<....
         8231  +|   3136: 03 32 69 6e 02 06 01 01 06 01 02 72 6f 02 06 01   .2in.......ro...
         8232  +|   3152: 01 05 04 09 18 88 80 80 80 80 0b 03 00 36 00 00   .............6..
         8233  +|   3168: 00 13 02 03 32 61 72 02 02 03 01 02 62 65 02 02   ....2ar.....be..
         8234  +|   3184: 04 05 07 1b 88 80 bf 80 80 0a 03 00 3c 00 00 00   ............<...
         8235  +|   3200: 16 02 31 74 02 08 02 01 01 07 00 03 32 61 6e 02   ..1t........2an.
         8236  +|   3216: 06 01 01 04 09 19 88 80 80 80 80 09 03 00 38 00   ..............8.
         8237  +|   3232: 00 00 14 02 31 6e 02 06 01 01 03 01 01 72 02 06   ....1n.......r..
         8238  +|   3248: 01 01 05 03 08 17 88 80 80 80 80 08 03 00 34 00   ..............4.
         8239  +|   3264: 01 00 12 02 31 62 02 02 04 01 01 69 02 06 01 01   ....1b.....i....
         8240  +|   3280: 06 04 06 19 88 80 80 80 80 07 03 00 38 00 00 00   ............8...
         8241  +|   3296: 14 04 02 31 32 02 02 05 01 01 61 02 08 03 01 01   ...12.....a.....
         8242  +|   3312: 02 05 06 1b 88 80 80 80 80 06 03 00 3c 00 00 00   ............<...
         8243  +|   3328: 16 06 30 74 68 65 72 65 02 12 02 00 02 31 31 02   ..0there.....11.
         8244  +|   3344: 06 01 01 04 0a 15 88 80 80 80 80 05 03 00 30 00   ..............0.
         8245  +|   3360: 00 00 11 01 01 05 04 30 74 68 65 02 06 71 01 07   .......0the..q..
         8246  +|   3376: 07 1c 88 80 80 80 80 04 03 00 3e 00 00 00 17 01   ..........>.....
         8247  +|   3392: 01 06 02 30 6e 02 06 01 01 03 01 04 72 6f 77 73   ...0n.......rows
         8248  +|   3408: 02 06 07 08 1b 88 80 80 80 80 03 03 00 3c 00 00   .............<..
         8249  +|   3424: 00 16 08 30 62 65 74 77 65 65 6e 02 02 04 01 02   ...0between.....
         8250  +|   3440: 69 6e 02 06 04 0c 1a 88 80 80 80 80 02 03 00 3a   in.............:
         8251  +|   3456: 08 f0 00 15 04 30 61 6e 64 02 06 01 01 02 02 02   .....0and.......
         8252  +|   3472: 72 65 02 02 03 04 0a 17 88 80 80 80 80 01 03 00   re..............
         8253  +|   3488: 34 00 00 00 12 02 30 31 02 06 01 01 04 01 01 32   4.....01.......2
         8254  +|   3504: 02 02 07 04 08 08 84 80 80 80 80 12 03 00 16 00   ................
         8255  +|   3520: 00 00 05 04 1b 84 80 80 80 80 11 03 00 3c 00 00   .............<..
         8256  +|   3536: 00 16 05 34 74 61 62 6c 01 06 01 01 05 02 03 65   ...4tabl.......e
         8257  +|   3552: 72 6d 01 02 04 0b 1b 84 80 80 80 80 10 03 00 3c   rm.............<
         8258  +|   3568: 00 00 00 16 05 34 65 61 63 68 01 02 03 01 04 70   .....4each.....p
         8259  +|   3584: 72 65 73 01 02 05 04 09 1a 84 80 80 80 80 0f 03   res.............
         8260  +|   3600: 00 3a 00 00 00 15 04 33 74 65 72 01 02 04 02 02   .:.....3ter.....
         8261  +|   3616: 68 65 01 06 01 01 03 04 08 1b 84 80 80 80 80 0e   he..............
         8262  +|   3632: 03 00 3c 00 00 00 16 04 33 70 72 65 01 02 05 01   ..<.....3pre....
         8263  +|   3648: 03 74 61 62 01 06 01 01 05 04 08 1a 84 80 80 80   .tab............
         8264  +|   3664: 80 0d 03 00 3a 00 00 00 15 04 33 66 6f 72 01 02   ....:.....3for..
         8265  +|   3680: 02 02 02 74 73 01 06 01 01 04 03 f8 1b 84 80 80   ...ts...........
         8266  +|   3696: 80 80 0c 03 00 3c 00 00 00 16 03 32 74 68 01 06   .....<.....2th..
         8267  +|   3712: 01 01 03 00 04 33 65 61 63 01 02 03 04 09 18 84   .....3eac.......
         8268  +|   3728: 80 80 80 80 0b 03 00 36 00 00 00 13 03 32 74 61   .......6.....2ta
         8269  +|   3744: 01 06 01 01 05 02 01 65 00 02 04 04 09 19 84 80   .......e........
         8270  +|   3760: 80 80 80 0a 03 10 38 00 00 00 14 03 32 69 6e 01   ......8.....2in.
         8271  +|   3776: 06 01 01 02 01 02 70 72 01 02 05 04 09 18 84 80   ......pr........
         8272  +|   3792: 80 80 80 09 03 00 36 00 00 00 13 03 32 66 6f 01   ......6.....2fo.
         8273  +|   3808: 02 02 02 01 74 01 06 01 01 04 04 07 1b 84 80 80   ....t...........
         8274  +|   3824: 80 80 08 03 00 3c 00 00 00 16 02 31 74 01 0a 04   .....<.....1t...
         8275  +|   3840: 01 00 03 04 00 03 32 65 61 01 02 03 04 0a 17 84   ......2ea.......
         8276  +|   3856: 80 80 80 80 07 03 00 34 00 00 00 12 02 31 69 01   .......4.....1i.
         8277  +|   3872: 06 01 01 02 de 01 70 01 02 05 04 08 18 84 80 80   ......p.........
         8278  +|   3888: 80 80 06 03 00 36 00 00 00 13 02 31 65 01 02 03   .....6.....1e...
         8279  +|   3904: 01 01 66 01 08 02 01 01 04 04 06 1b 84 80 80 80   ..f.............
         8280  +|   3920: 80 05 03 00 3c 00 00 00 16 05 30 74 65 72 6d 01   ....<.....0term.
         8281  +|   3936: 02 04 02 02 68 65 01 06 01 01 03 04 09 14 84 80   ....he..........
         8282  +|   3952: 80 80 80 04 03 00 2e 00 00 00 10 06 30 74 61 62   ............0tab
         8283  +|   3968: 6c 65 01 06 01 01 05 04 15 84 80 80 80 80 03 03   le..............
         8284  +|   3984: 00 30 00 00 00 11 02 08 30 70 72 65 73 65 6e 74   .0......0present
         8285  +|   4000: 01 02 05 05 1b 84 80 80 80 80 02 03 00 3c 00 00   .............<..
         8286  +|   4016: 00 16 04 30 66 74 73 01 06 01 01 04 01 02 69 6e   ...0fts.......in
         8287  +|   4032: 01 06 01 01 04 0a 1a 84 80 80 80 80 01 03 00 3a   ...............:
         8288  +|   4048: 00 00 00 15 05 30 65 61 63 68 00 f2 03 01 03 66   .....0each.....f
         8289  +|   4064: 6f 72 01 02 02 04 09 06 01 03 00 12 03 0b 0f 00   or..............
         8290  +|   4080: 00 08 8c 80 80 80 80 11 03 00 16 00 00 00 05 04   ................
         8291  +| page 3 offset 8192
         8292  +|      0: 0a 00 00 00 32 0e 4f 00 0f fa 0f f1 0f e9 0f e1   ....2.O.........
         8293  +|     16: 0f d8 0f d1 0f c9 0f c1 0f b9 0f c1 0f a9 0f a0   ................
         8294  +|     32: 0f 98 0f 90 0f 87 0f 80 0f 78 0f 71 0f 68 0f 5f   .........x.q.h._
         8295  +|     48: 0f 56 0f 4d 0f 41 0f 38 0f 2f 0f 26 0f 1d 0f 13   .V.M.A.8./.&....
         8296  +|     64: 0f 0a 0f 01 0e f7 0e ee 0e e6 0e dd 0e d7 0e cd   ................
         8297  +|     80: 0e c3 0e ba 0e b0 0e a8 0e 9f 0e 96 0e 8e 0e 85   ................
         8298  +|   3648: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08   ................
         8299  +|   3664: 04 01 10 01 03 34 74 20 07 04 01 0e 01 03 34 1e   .....4t ......4.
         8300  +|   3680: 09 04 01 12 34 03 33 74 68 1c 08 04 01 10 01 03   ....4.3th.......
         8301  +|   3696: 33 6e 1a 08 04 01 10 01 03 32 77 18 08 04 01 10   3n.......2w.....
         8302  +|   3712: 01 03 32 74 16 08 04 01 10 01 03 32 6e 14 07 04   ..2t.......2n...
         8303  +|   3728: 01 0e 01 03 32 12 08 04 01 0f f1 03 31 74 10 08   ....2.......1t..
         8304  +|   3744: 04 01 10 01 03 31 6e 0e 07 04 01 0e 01 03 30 fc   .....1n.......0.
         8305  +|   3760: 09 04 01 12 01 03 30 74 68 0a 08 04 01 10 01 03   ......0th.......
         8306  +|   3776: 30 74 08 09 04 01 12 01 03 30 6e 75 06 08 04 01   0t.......0nu....
         8307  +|   3792: 10 01 03 30 6e 04 06 04 01 0c 01 05 52 08 04 01   ...0n.......R...
         8308  +|   3808: 10 01 02 34 72 22 07 04 01 0e 01 02 34 20 08 04   ...4r.......4 ..
         8309  +|   3824: 01 10 01 02 33 72 1e 09 04 01 12 01 02 33 61 72   ....3r.......3ar
         8310  +|   3840: 1c 08 04 01 10 01 02 32 74 1a 08 04 01 10 b3 02   .......2t.......
         8311  +|   3856: 32 69 18 09 04 01 12 01 02 32 61 72 16 08 04 01   2i.......2ar....
         8312  +|   3872: 10 01 02 31 74 14 08 04 01 10 01 02 31 6e 12 08   ...1t.......1n..
         8313  +|   3888: 04 01 10 01 02 31 62 10 08 04 01 10 01 02 31 32   .....1b.......12
         8314  +|   3904: 0e 0b 04 01 16 01 02 30 74 68 65 72 0c 08 04 01   .......0ther....
         8315  +|   3920: 10 01 02 30 74 0a 08 04 01 10 01 02 30 6e 08 08   ...0t.......0n..
         8316  +|   3936: 04 01 10 01 02 30 62 06 09 04 01 10 01 02 30 61   .....0b.......0a
         8317  +|   3952: 04 06 04 01 0c 01 02 02 07 04 09 10 01 34 74 22   .............4t.
         8318  +|   3968: 06 04 09 0e 01 34 20 08 04 09 12 01 33 74 65 1e   .....4 .....3te.
         8319  +|   3984: 07 04 09 10 01 33 70 1c 07 f4 09 11 01 33 66 1a   .....3p......3f.
         8320  +|   4000: 08 04 09 12 01 32 74 68 18 07 04 09 10 01 32 e4   .....2th......2.
         8321  +|   4016: 16 07 04 09 10 01 32 69 14 07 04 09 10 01 32 66   ......2i......2f
         8322  +|   4032: 12 07 04 09 10 01 31 74 10 07 04 09 10 01 31 69   ......1t......1i
         8323  +|   4048: 0e 06 04 09 0e 01 31 0c 08 04 09 12 01 30 74 65   ......1......0te
         8324  +|   4064: 0a 07 04 09 10 01 30 74 08 00 00 00 00 00 00 00   ......0t........
         8325  +| page 4 offset 12288
         8326  +|   4064: 00 00 00 00 00 00 00 00 00 00 00 05 03 03 00 10   ................
         8327  +|   4080: 03 05 05 02 03 00 10 04 06 05 01 03 00 10 04 04   ................
         8328  +| page 5 offset 16384
         8329  +|      0: 0a 00 00 00 02 0f eb 00 0f eb 0f f4 00 00 00 00   ................
         8330  +|   4064: 00 00 00 00 00 00 00 00 00 00 00 08 03 15 01 70   ...............p
         8331  +|   4080: 67 73 7a 18 0b 03 1b 01 76 65 72 73 69 6f 6e 04   gsz.....version.
         8332  +| page 6 offset 20480
         8333  +|   4080: 00 00 23 03 02 01 03 03 02 00 00 00 00 00 00 00   ..#.............
         8334  +| end crash-5a5acd0ab42d31.db
         8335  +}]} {}
         8336  +
         8337  +do_execsql_test 58.1 {
         8338  +  SELECT * FROM t1('t*');
         8339  +} {{} {} {} {} {} {}}
  8131   8340   
  8132   8341   sqlite3_fts5_may_be_corrupt 0
  8133   8342   finish_test
  8134   8343   

Changes to src/alter.c.

    50     50   ** statement to ensure that the operation has not rendered any schema
    51     51   ** objects unusable.
    52     52   */
    53     53   static void renameTestSchema(Parse *pParse, const char *zDb, int bTemp){
    54     54     sqlite3NestedParse(pParse, 
    55     55         "SELECT 1 "
    56     56         "FROM \"%w\".%s "
    57         -      "WHERE name NOT LIKE 'sqlite_%%'"
           57  +      "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
    58     58         " AND sql NOT LIKE 'create virtual%%'"
    59     59         " AND sqlite_rename_test(%Q, sql, type, name, %d)=NULL ",
    60     60         zDb, MASTER_NAME, 
    61     61         zDb, bTemp
    62     62     );
    63     63   
    64     64     if( bTemp==0 ){
    65     65       sqlite3NestedParse(pParse, 
    66     66           "SELECT 1 "
    67     67           "FROM temp.%s "
    68         -        "WHERE name NOT LIKE 'sqlite_%%'"
           68  +        "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
    69     69           " AND sql NOT LIKE 'create virtual%%'"
    70     70           " AND sqlite_rename_test(%Q, sql, type, name, 1)=NULL ",
    71     71           MASTER_NAME, zDb 
    72     72       );
    73     73     }
    74     74   }
    75     75   
................................................................................
   182    182   
   183    183     /* Rewrite all CREATE TABLE, INDEX, TRIGGER or VIEW statements in
   184    184     ** the schema to use the new table name.  */
   185    185     sqlite3NestedParse(pParse, 
   186    186         "UPDATE \"%w\".%s SET "
   187    187         "sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) "
   188    188         "WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)"
   189         -      "AND   name NOT LIKE 'sqlite_%%'"
          189  +      "AND   name NOT LIKE 'sqliteX_%%' ESCAPE 'X'"
   190    190         , zDb, MASTER_NAME, zDb, zTabName, zName, (iDb==1), zTabName
   191    191     );
   192    192   
   193    193     /* Update the tbl_name and name columns of the sqlite_master table
   194    194     ** as required.  */
   195    195     sqlite3NestedParse(pParse,
   196    196         "UPDATE %Q.%s SET "
   197    197             "tbl_name = %Q, "
   198    198             "name = CASE "
   199    199               "WHEN type='table' THEN %Q "
   200         -            "WHEN name LIKE 'sqlite_autoindex%%' AND type='index' THEN "
          200  +            "WHEN name LIKE 'sqliteX_autoindex%%' ESCAPE 'X' "
          201  +            "     AND type='index' THEN "
   201    202                "'sqlite_autoindex_' || %Q || substr(name,%d+18) "
   202    203               "ELSE name END "
   203    204         "WHERE tbl_name=%Q COLLATE nocase AND "
   204    205             "(type='table' OR type='index' OR type='trigger');", 
   205    206         zDb, MASTER_NAME, 
   206    207         zName, zName, zName, 
   207    208         nTabName, zTabName
................................................................................
   567    568     zNew = sqlite3NameFromToken(db, pNew);
   568    569     if( !zNew ) goto exit_rename_column;
   569    570     assert( pNew->n>0 );
   570    571     bQuote = sqlite3Isquote(pNew->z[0]);
   571    572     sqlite3NestedParse(pParse, 
   572    573         "UPDATE \"%w\".%s SET "
   573    574         "sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) "
   574         -      "WHERE name NOT LIKE 'sqlite_%%' AND (type != 'index' OR tbl_name = %Q)"
          575  +      "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' "
          576  +      " AND (type != 'index' OR tbl_name = %Q)"
   575    577         " AND sql NOT LIKE 'create virtual%%'",
   576    578         zDb, MASTER_NAME, 
   577    579         zDb, pTab->zName, iCol, zNew, bQuote, iSchema==1,
   578    580         pTab->zName
   579    581     );
   580    582   
   581    583     sqlite3NestedParse(pParse, 

Changes to src/btree.c.

  4280   4280       if( rc==SQLITE_OK ){
  4281   4281         if( iSavepoint<0 && (pBt->btsFlags & BTS_INITIALLY_EMPTY)!=0 ){
  4282   4282           pBt->nPage = 0;
  4283   4283         }
  4284   4284         rc = newDatabase(pBt);
  4285   4285         pBt->nPage = get4byte(28 + pBt->pPage1->aData);
  4286   4286   
  4287         -      /* The database size was written into the offset 28 of the header
  4288         -      ** when the transaction started, so we know that the value at offset
  4289         -      ** 28 is nonzero. */
  4290         -      assert( pBt->nPage>0 );
         4287  +      /* pBt->nPage might be zero if the database was corrupt when 
         4288  +      ** the transaction was started. Otherwise, it must be at least 1.  */
         4289  +      assert( CORRUPT_DB || pBt->nPage>0 );
  4291   4290       }
  4292   4291       sqlite3BtreeLeave(p);
  4293   4292     }
  4294   4293     return rc;
  4295   4294   }
  4296   4295   
  4297   4296   /*

Changes to src/expr.c.

   769    769     pNew = sqlite3DbMallocRawNN(db, sizeof(Expr)+nExtra);
   770    770     if( pNew ){
   771    771       memset(pNew, 0, sizeof(Expr));
   772    772       pNew->op = (u8)op;
   773    773       pNew->iAgg = -1;
   774    774       if( pToken ){
   775    775         if( nExtra==0 ){
   776         -        pNew->flags |= EP_IntValue|EP_Leaf;
          776  +        pNew->flags |= EP_IntValue|EP_Leaf|(iValue?EP_IsTrue:EP_IsFalse);
   777    777           pNew->u.iValue = iValue;
   778    778         }else{
   779    779           pNew->u.zToken = (char*)&pNew[1];
   780    780           assert( pToken->z!=0 || pToken->n==0 );
   781    781           if( pToken->n ) memcpy(pNew->u.zToken, pToken->z, pToken->n);
   782    782           pNew->u.zToken[pToken->n] = 0;
   783    783           if( dequote && sqlite3Isquote(pNew->u.zToken[0]) ){
................................................................................
   846    846   Expr *sqlite3PExpr(
   847    847     Parse *pParse,          /* Parsing context */
   848    848     int op,                 /* Expression opcode */
   849    849     Expr *pLeft,            /* Left operand */
   850    850     Expr *pRight            /* Right operand */
   851    851   ){
   852    852     Expr *p;
   853         -  if( op==TK_AND && pParse->nErr==0 && !IN_RENAME_OBJECT ){
   854         -    /* Take advantage of short-circuit false optimization for AND */
   855         -    p = sqlite3ExprAnd(pParse->db, pLeft, pRight);
   856         -  }else{
   857         -    p = sqlite3DbMallocRawNN(pParse->db, sizeof(Expr));
   858         -    if( p ){
   859         -      memset(p, 0, sizeof(Expr));
   860         -      p->op = op & 0xff;
   861         -      p->iAgg = -1;
   862         -    }
          853  +  p = sqlite3DbMallocRawNN(pParse->db, sizeof(Expr));
          854  +  if( p ){
          855  +    memset(p, 0, sizeof(Expr));
          856  +    p->op = op & 0xff;
          857  +    p->iAgg = -1;
   863    858       sqlite3ExprAttachSubtrees(pParse->db, p, pLeft, pRight);
   864         -  }
   865         -  if( p ) {
   866    859       sqlite3ExprCheckHeight(pParse, p->nHeight);
          860  +  }else{
          861  +    sqlite3ExprDelete(pParse->db, pLeft);
          862  +    sqlite3ExprDelete(pParse->db, pRight);
   867    863     }
   868    864     return p;
   869    865   }
   870    866   
   871    867   /*
   872    868   ** Add pSelect to the Expr.x.pSelect field.  Or, if pExpr is NULL (due
   873    869   ** do a memory allocation failure) then delete the pSelect object.
................................................................................
   880    876     }else{
   881    877       assert( pParse->db->mallocFailed );
   882    878       sqlite3SelectDelete(pParse->db, pSelect);
   883    879     }
   884    880   }
   885    881   
   886    882   
   887         -/*
   888         -** If the expression is always either TRUE or FALSE (respectively),
   889         -** then return 1.  If one cannot determine the truth value of the
   890         -** expression at compile-time return 0.
   891         -**
   892         -** This is an optimization.  If is OK to return 0 here even if
   893         -** the expression really is always false or false (a false negative).
   894         -** But it is a bug to return 1 if the expression might have different
   895         -** boolean values in different circumstances (a false positive.)
   896         -**
   897         -** Note that if the expression is part of conditional for a
   898         -** LEFT JOIN, then we cannot determine at compile-time whether or not
   899         -** is it true or false, so always return 0.
   900         -*/
   901         -static int exprAlwaysTrue(Expr *p){
   902         -  int v = 0;
   903         -  if( ExprHasProperty(p, EP_FromJoin) ) return 0;
   904         -  if( !sqlite3ExprIsInteger(p, &v) ) return 0;
   905         -  return v!=0;
   906         -}
   907         -static int exprAlwaysFalse(Expr *p){
   908         -  int v = 0;
   909         -  if( ExprHasProperty(p, EP_FromJoin) ) return 0;
   910         -  if( !sqlite3ExprIsInteger(p, &v) ) return 0;
   911         -  return v==0;
   912         -}
   913         -
   914    883   /*
   915    884   ** Join two expressions using an AND operator.  If either expression is
   916    885   ** NULL, then just return the other expression.
   917    886   **
   918    887   ** If one side or the other of the AND is known to be false, then instead
   919    888   ** of returning an AND expression, just return a constant expression with
   920    889   ** a value of false.
   921    890   */
   922         -Expr *sqlite3ExprAnd(sqlite3 *db, Expr *pLeft, Expr *pRight){
   923         -  if( pLeft==0 ){
          891  +Expr *sqlite3ExprAnd(Parse *pParse, Expr *pLeft, Expr *pRight){
          892  +  sqlite3 *db = pParse->db;
          893  +  if( pLeft==0  ){
   924    894       return pRight;
   925    895     }else if( pRight==0 ){
   926    896       return pLeft;
   927         -  }else if( exprAlwaysFalse(pLeft) || exprAlwaysFalse(pRight) ){
          897  +  }else if( pParse->nErr || IN_RENAME_OBJECT ){
          898  +    return sqlite3PExpr(pParse, TK_AND, pLeft, pRight);
          899  +  }else if( ExprAlwaysFalse(pLeft) || ExprAlwaysFalse(pRight) ){
   928    900       sqlite3ExprDelete(db, pLeft);
   929    901       sqlite3ExprDelete(db, pRight);
   930    902       return sqlite3ExprAlloc(db, TK_INTEGER, &sqlite3IntTokens[0], 0);
   931    903     }else{
   932         -    Expr *pNew = sqlite3ExprAlloc(db, TK_AND, 0, 0);
   933         -    sqlite3ExprAttachSubtrees(db, pNew, pLeft, pRight);
   934         -    return pNew;
          904  +    return sqlite3PExpr(pParse, TK_AND, pLeft, pRight);
   935    905     }
   936    906   }
   937    907   
   938    908   /*
   939    909   ** Construct a new expression node for a function with multiple
   940    910   ** arguments.
   941    911   */
................................................................................
  1817   1787   int sqlite3ExprIdToTrueFalse(Expr *pExpr){
  1818   1788     assert( pExpr->op==TK_ID || pExpr->op==TK_STRING );
  1819   1789     if( !ExprHasProperty(pExpr, EP_Quoted)
  1820   1790      && (sqlite3StrICmp(pExpr->u.zToken, "true")==0
  1821   1791          || sqlite3StrICmp(pExpr->u.zToken, "false")==0)
  1822   1792     ){
  1823   1793       pExpr->op = TK_TRUEFALSE;
         1794  +    ExprSetProperty(pExpr, pExpr->u.zToken[4]==0 ? EP_IsTrue : EP_IsFalse);
  1824   1795       return 1;
  1825   1796     }
  1826   1797     return 0;
  1827   1798   }
  1828   1799   
  1829   1800   /*
  1830   1801   ** The argument must be a TK_TRUEFALSE Expr node.  Return 1 if it is TRUE
................................................................................
  1832   1803   */
  1833   1804   int sqlite3ExprTruthValue(const Expr *pExpr){
  1834   1805     assert( pExpr->op==TK_TRUEFALSE );
  1835   1806     assert( sqlite3StrICmp(pExpr->u.zToken,"true")==0
  1836   1807          || sqlite3StrICmp(pExpr->u.zToken,"false")==0 );
  1837   1808     return pExpr->u.zToken[4]==0;
  1838   1809   }
         1810  +
         1811  +/*
         1812  +** If pExpr is an AND or OR expression, try to simplify it by eliminating
         1813  +** terms that are always true or false.  Return the simplified expression.
         1814  +** Or return the original expression if no simplification is possible.
         1815  +**
         1816  +** Examples:
         1817  +**
         1818  +**     (x<10) AND true                =>   (x<10)
         1819  +**     (x<10) AND false               =>   false
         1820  +**     (x<10) AND (y=22 OR false)     =>   (x<10) AND (y=22)
         1821  +**     (x<10) AND (y=22 OR true)      =>   (x<10)
         1822  +**     (y=22) OR true                 =>   true
         1823  +*/
         1824  +Expr *sqlite3ExprSimplifiedAndOr(Expr *pExpr){
         1825  +  assert( pExpr!=0 );
         1826  +  if( pExpr->op==TK_AND || pExpr->op==TK_OR ){
         1827  +    Expr *pRight = sqlite3ExprSimplifiedAndOr(pExpr->pRight);
         1828  +    Expr *pLeft = sqlite3ExprSimplifiedAndOr(pExpr->pLeft);
         1829  +    if( ExprAlwaysTrue(pLeft) || ExprAlwaysFalse(pRight) ){
         1830  +      pExpr = pExpr->op==TK_AND ? pRight : pLeft;
         1831  +    }else if( ExprAlwaysTrue(pRight) || ExprAlwaysFalse(pLeft) ){
         1832  +      pExpr = pExpr->op==TK_AND ? pLeft : pRight;
         1833  +    }
         1834  +  }
         1835  +  return pExpr;
         1836  +}
  1839   1837   
  1840   1838   
  1841   1839   /*
  1842   1840   ** These routines are Walker callbacks used to check expressions to
  1843   1841   ** see if they are "constant" for some definition of constant.  The
  1844   1842   ** Walker.eCode value determines the type of "constant" we are looking
  1845   1843   ** for.
................................................................................
  2077   2075   ** If the expression p codes a constant integer that is small enough
  2078   2076   ** to fit in a 32-bit integer, return 1 and put the value of the integer
  2079   2077   ** in *pValue.  If the expression is not an integer or if it is too big
  2080   2078   ** to fit in a signed 32-bit integer, return 0 and leave *pValue unchanged.
  2081   2079   */
  2082   2080   int sqlite3ExprIsInteger(Expr *p, int *pValue){
  2083   2081     int rc = 0;
  2084         -  if( p==0 ) return 0;  /* Can only happen following on OOM */
         2082  +  if( NEVER(p==0) ) return 0;  /* Used to only happen following on OOM */
  2085   2083   
  2086   2084     /* If an expression is an integer literal that fits in a signed 32-bit
  2087   2085     ** integer, then the EP_IntValue flag will have already been set */
  2088   2086     assert( p->op!=TK_INTEGER || (p->flags & EP_IntValue)!=0
  2089   2087              || sqlite3GetInt32(p->u.zToken, &rc)==0 );
  2090   2088   
  2091   2089     if( p->flags & EP_IntValue ){
................................................................................
  4424   4422     int r1, r2;
  4425   4423   
  4426   4424     assert( jumpIfNull==SQLITE_JUMPIFNULL || jumpIfNull==0 );
  4427   4425     if( NEVER(v==0) )     return;  /* Existence of VDBE checked by caller */
  4428   4426     if( NEVER(pExpr==0) ) return;  /* No way this can happen */
  4429   4427     op = pExpr->op;
  4430   4428     switch( op ){
  4431         -    case TK_AND: {
  4432         -      int d2 = sqlite3VdbeMakeLabel(pParse);
  4433         -      testcase( jumpIfNull==0 );
  4434         -      sqlite3ExprIfFalse(pParse, pExpr->pLeft, d2,jumpIfNull^SQLITE_JUMPIFNULL);
  4435         -      sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
  4436         -      sqlite3VdbeResolveLabel(v, d2);
  4437         -      break;
  4438         -    }
         4429  +    case TK_AND:
  4439   4430       case TK_OR: {
  4440         -      testcase( jumpIfNull==0 );
  4441         -      sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);
  4442         -      sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
         4431  +      Expr *pAlt = sqlite3ExprSimplifiedAndOr(pExpr);
         4432  +      if( pAlt!=pExpr ){
         4433  +        sqlite3ExprIfTrue(pParse, pAlt, dest, jumpIfNull);
         4434  +      }else if( op==TK_AND ){
         4435  +        int d2 = sqlite3VdbeMakeLabel(pParse);
         4436  +        testcase( jumpIfNull==0 );
         4437  +        sqlite3ExprIfFalse(pParse, pExpr->pLeft, d2,
         4438  +                           jumpIfNull^SQLITE_JUMPIFNULL);
         4439  +        sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
         4440  +        sqlite3VdbeResolveLabel(v, d2);
         4441  +      }else{
         4442  +        testcase( jumpIfNull==0 );
         4443  +        sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);
         4444  +        sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
         4445  +      }
  4443   4446         break;
  4444   4447       }
  4445   4448       case TK_NOT: {
  4446   4449         testcase( jumpIfNull==0 );
  4447   4450         sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);
  4448   4451         break;
  4449   4452       }
................................................................................
  4521   4524         sqlite3VdbeGoto(v, dest);
  4522   4525         sqlite3VdbeResolveLabel(v, destIfFalse);
  4523   4526         break;
  4524   4527       }
  4525   4528   #endif
  4526   4529       default: {
  4527   4530       default_expr:
  4528         -      if( exprAlwaysTrue(pExpr) ){
         4531  +      if( ExprAlwaysTrue(pExpr) ){
  4529   4532           sqlite3VdbeGoto(v, dest);
  4530         -      }else if( exprAlwaysFalse(pExpr) ){
         4533  +      }else if( ExprAlwaysFalse(pExpr) ){
  4531   4534           /* No-op */
  4532   4535         }else{
  4533   4536           r1 = sqlite3ExprCodeTemp(pParse, pExpr, &regFree1);
  4534   4537           sqlite3VdbeAddOp3(v, OP_If, r1, dest, jumpIfNull!=0);
  4535   4538           VdbeCoverage(v);
  4536   4539           testcase( regFree1==0 );
  4537   4540           testcase( jumpIfNull==0 );
................................................................................
  4591   4594     assert( pExpr->op!=TK_EQ || op==OP_Ne );
  4592   4595     assert( pExpr->op!=TK_LT || op==OP_Ge );
  4593   4596     assert( pExpr->op!=TK_LE || op==OP_Gt );
  4594   4597     assert( pExpr->op!=TK_GT || op==OP_Le );
  4595   4598     assert( pExpr->op!=TK_GE || op==OP_Lt );
  4596   4599   
  4597   4600     switch( pExpr->op ){
  4598         -    case TK_AND: {
  4599         -      testcase( jumpIfNull==0 );
  4600         -      sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);
  4601         -      sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
  4602         -      break;
  4603         -    }
         4601  +    case TK_AND:
  4604   4602       case TK_OR: {
  4605         -      int d2 = sqlite3VdbeMakeLabel(pParse);
  4606         -      testcase( jumpIfNull==0 );
  4607         -      sqlite3ExprIfTrue(pParse, pExpr->pLeft, d2, jumpIfNull^SQLITE_JUMPIFNULL);
  4608         -      sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
  4609         -      sqlite3VdbeResolveLabel(v, d2);
         4603  +      Expr *pAlt = sqlite3ExprSimplifiedAndOr(pExpr);
         4604  +      if( pAlt!=pExpr ){
         4605  +        sqlite3ExprIfFalse(pParse, pAlt, dest, jumpIfNull);
         4606  +      }else if( pExpr->op==TK_AND ){
         4607  +        testcase( jumpIfNull==0 );
         4608  +        sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);
         4609  +        sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
         4610  +      }else{
         4611  +        int d2 = sqlite3VdbeMakeLabel(pParse);
         4612  +        testcase( jumpIfNull==0 );
         4613  +        sqlite3ExprIfTrue(pParse, pExpr->pLeft, d2,
         4614  +                          jumpIfNull^SQLITE_JUMPIFNULL);
         4615  +        sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
         4616  +        sqlite3VdbeResolveLabel(v, d2);
         4617  +      }
  4610   4618         break;
  4611   4619       }
  4612   4620       case TK_NOT: {
  4613   4621         testcase( jumpIfNull==0 );
  4614   4622         sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);
  4615   4623         break;
  4616   4624       }
................................................................................
  4691   4699           sqlite3VdbeResolveLabel(v, destIfNull);
  4692   4700         }
  4693   4701         break;
  4694   4702       }
  4695   4703   #endif
  4696   4704       default: {
  4697   4705       default_expr: 
  4698         -      if( exprAlwaysFalse(pExpr) ){
         4706  +      if( ExprAlwaysFalse(pExpr) ){
  4699   4707           sqlite3VdbeGoto(v, dest);
  4700         -      }else if( exprAlwaysTrue(pExpr) ){
         4708  +      }else if( ExprAlwaysTrue(pExpr) ){
  4701   4709           /* no-op */
  4702   4710         }else{
  4703   4711           r1 = sqlite3ExprCodeTemp(pParse, pExpr, &regFree1);
  4704   4712           sqlite3VdbeAddOp3(v, OP_IfNot, r1, dest, jumpIfNull!=0);
  4705   4713           VdbeCoverage(v);
  4706   4714           testcase( regFree1==0 );
  4707   4715           testcase( jumpIfNull==0 );

Changes to src/fkey.c.

   587    587       iCol = pIdx ? pIdx->aiColumn[i] : -1;
   588    588       pLeft = exprTableRegister(pParse, pTab, regData, iCol);
   589    589       iCol = aiCol ? aiCol[i] : pFKey->aCol[0].iFrom;
   590    590       assert( iCol>=0 );
   591    591       zCol = pFKey->pFrom->aCol[iCol].zName;
   592    592       pRight = sqlite3Expr(db, TK_ID, zCol);
   593    593       pEq = sqlite3PExpr(pParse, TK_EQ, pLeft, pRight);
   594         -    pWhere = sqlite3ExprAnd(db, pWhere, pEq);
          594  +    pWhere = sqlite3ExprAnd(pParse, pWhere, pEq);
   595    595     }
   596    596   
   597    597     /* If the child table is the same as the parent table, then add terms
   598    598     ** to the WHERE clause that prevent this entry from being scanned.
   599    599     ** The added WHERE clause terms are like this:
   600    600     **
   601    601     **     $current_rowid!=rowid
................................................................................
   621    621         assert( pIdx!=0 );
   622    622         for(i=0; i<pIdx->nKeyCol; i++){
   623    623           i16 iCol = pIdx->aiColumn[i];
   624    624           assert( iCol>=0 );
   625    625           pLeft = exprTableRegister(pParse, pTab, regData, iCol);
   626    626           pRight = sqlite3Expr(db, TK_ID, pTab->aCol[iCol].zName);
   627    627           pEq = sqlite3PExpr(pParse, TK_IS, pLeft, pRight);
   628         -        pAll = sqlite3ExprAnd(db, pAll, pEq);
          628  +        pAll = sqlite3ExprAnd(pParse, pAll, pEq);
   629    629         }
   630    630         pNe = sqlite3PExpr(pParse, TK_NOT, pAll, 0);
   631    631       }
   632         -    pWhere = sqlite3ExprAnd(db, pWhere, pNe);
          632  +    pWhere = sqlite3ExprAnd(pParse, pWhere, pNe);
   633    633     }
   634    634   
   635    635     /* Resolve the references in the WHERE clause. */
   636    636     memset(&sNameContext, 0, sizeof(NameContext));
   637    637     sNameContext.pSrcList = pSrc;
   638    638     sNameContext.pParse = pParse;
   639    639     sqlite3ResolveExprNames(&sNameContext, pWhere);
................................................................................
  1231   1231         ** parent table are used for the comparison. */
  1232   1232         pEq = sqlite3PExpr(pParse, TK_EQ,
  1233   1233             sqlite3PExpr(pParse, TK_DOT, 
  1234   1234               sqlite3ExprAlloc(db, TK_ID, &tOld, 0),
  1235   1235               sqlite3ExprAlloc(db, TK_ID, &tToCol, 0)),
  1236   1236             sqlite3ExprAlloc(db, TK_ID, &tFromCol, 0)
  1237   1237         );
  1238         -      pWhere = sqlite3ExprAnd(db, pWhere, pEq);
         1238  +      pWhere = sqlite3ExprAnd(pParse, pWhere, pEq);
  1239   1239   
  1240   1240         /* For ON UPDATE, construct the next term of the WHEN clause.
  1241   1241         ** The final WHEN clause will be like this:
  1242   1242         **
  1243   1243         **    WHEN NOT(old.col1 IS new.col1 AND ... AND old.colN IS new.colN)
  1244   1244         */
  1245   1245         if( pChanges ){
................................................................................
  1247   1247               sqlite3PExpr(pParse, TK_DOT, 
  1248   1248                 sqlite3ExprAlloc(db, TK_ID, &tOld, 0),
  1249   1249                 sqlite3ExprAlloc(db, TK_ID, &tToCol, 0)),
  1250   1250               sqlite3PExpr(pParse, TK_DOT, 
  1251   1251                 sqlite3ExprAlloc(db, TK_ID, &tNew, 0),
  1252   1252                 sqlite3ExprAlloc(db, TK_ID, &tToCol, 0))
  1253   1253               );
  1254         -        pWhen = sqlite3ExprAnd(db, pWhen, pEq);
         1254  +        pWhen = sqlite3ExprAnd(pParse, pWhen, pEq);
  1255   1255         }
  1256   1256     
  1257   1257         if( action!=OE_Restrict && (action!=OE_Cascade || pChanges) ){
  1258   1258           Expr *pNew;
  1259   1259           if( action==OE_Cascade ){
  1260   1260             pNew = sqlite3PExpr(pParse, TK_DOT, 
  1261   1261               sqlite3ExprAlloc(db, TK_ID, &tNew, 0),

Changes to src/msvc.h.

    29     29   #pragma warning(disable : 4244)
    30     30   #pragma warning(disable : 4305)
    31     31   #pragma warning(disable : 4306)
    32     32   #pragma warning(disable : 4702)
    33     33   #pragma warning(disable : 4706)
    34     34   #endif /* defined(_MSC_VER) */
    35     35   
           36  +#if defined(_MSC_VER) && !defined(_WIN64)
           37  +#undef SQLITE_4_BYTE_ALIGNED_MALLOC
           38  +#define SQLITE_4_BYTE_ALIGNED_MALLOC
           39  +#endif /* defined(_MSC_VER) && !defined(_WIN64) */
           40  +
    36     41   #endif /* SQLITE_MSVC_H */

Changes to src/parse.y.

  1060   1060     if( A ){
  1061   1061       A->x.pList = pList;
  1062   1062     }else{
  1063   1063       sqlite3ExprListDelete(pParse->db, pList);
  1064   1064     }
  1065   1065   }
  1066   1066   
  1067         -expr(A) ::= expr(A) AND(OP) expr(Y).    {A=sqlite3PExpr(pParse,@OP,A,Y);}
         1067  +expr(A) ::= expr(A) AND expr(Y).        {A=sqlite3ExprAnd(pParse,A,Y);}
  1068   1068   expr(A) ::= expr(A) OR(OP) expr(Y).     {A=sqlite3PExpr(pParse,@OP,A,Y);}
  1069   1069   expr(A) ::= expr(A) LT|GT|GE|LE(OP) expr(Y).
  1070   1070                                           {A=sqlite3PExpr(pParse,@OP,A,Y);}
  1071   1071   expr(A) ::= expr(A) EQ|NE(OP) expr(Y).  {A=sqlite3PExpr(pParse,@OP,A,Y);}
  1072   1072   expr(A) ::= expr(A) BITAND|BITOR|LSHIFT|RSHIFT(OP) expr(Y).
  1073   1073                                           {A=sqlite3PExpr(pParse,@OP,A,Y);}
  1074   1074   expr(A) ::= expr(A) PLUS|MINUS(OP) expr(Y).

Changes to src/select.c.

   351    351     pEq = sqlite3PExpr(pParse, TK_EQ, pE1, pE2);
   352    352     if( pEq && isOuterJoin ){
   353    353       ExprSetProperty(pEq, EP_FromJoin);
   354    354       assert( !ExprHasProperty(pEq, EP_TokenOnly|EP_Reduced) );
   355    355       ExprSetVVAProperty(pEq, EP_NoReduce);
   356    356       pEq->iRightJoinTable = (i16)pE2->iTable;
   357    357     }
   358         -  *ppWhere = sqlite3ExprAnd(db, *ppWhere, pEq);
          358  +  *ppWhere = sqlite3ExprAnd(pParse, *ppWhere, pEq);
   359    359   }
   360    360   
   361    361   /*
   362    362   ** Set the EP_FromJoin property on all terms of the given expression.
   363    363   ** And set the Expr.iRightJoinTable to iTable for every term in the
   364    364   ** expression.
   365    365   **
................................................................................
   485    485       }
   486    486   
   487    487       /* Add the ON clause to the end of the WHERE clause, connected by
   488    488       ** an AND operator.
   489    489       */
   490    490       if( pRight->pOn ){
   491    491         if( isOuter ) setJoinExpr(pRight->pOn, pRight->iCursor);
   492         -      p->pWhere = sqlite3ExprAnd(pParse->db, p->pWhere, pRight->pOn);
          492  +      p->pWhere = sqlite3ExprAnd(pParse, p->pWhere, pRight->pOn);
   493    493         pRight->pOn = 0;
   494    494       }
   495    495   
   496    496       /* Create extra terms on the WHERE clause for each column named
   497    497       ** in the USING clause.  Example: If the two tables to be joined are 
   498    498       ** A and B and the USING clause names X, Y, and Z, then add this
   499    499       ** to the WHERE clause:    A.X=B.X AND A.Y=B.Y AND A.Z=B.Z
................................................................................
  4030   4030         pSub->pOrderBy = 0;
  4031   4031       }
  4032   4032       pWhere = pSub->pWhere;
  4033   4033       pSub->pWhere = 0;
  4034   4034       if( isLeftJoin>0 ){
  4035   4035         setJoinExpr(pWhere, iNewParent);
  4036   4036       }
  4037         -    pParent->pWhere = sqlite3ExprAnd(db, pWhere, pParent->pWhere);
         4037  +    pParent->pWhere = sqlite3ExprAnd(pParse, pWhere, pParent->pWhere);
  4038   4038       if( db->mallocFailed==0 ){
  4039   4039         SubstContext x;
  4040   4040         x.pParse = pParse;
  4041   4041         x.iTable = iParent;
  4042   4042         x.iNewTable = iNewParent;
  4043   4043         x.isLeftJoin = isLeftJoin;
  4044   4044         x.pEList = pSub->pEList;
................................................................................
  4365   4365         x.pParse = pParse;
  4366   4366         x.iTable = iCursor;
  4367   4367         x.iNewTable = iCursor;
  4368   4368         x.isLeftJoin = 0;
  4369   4369         x.pEList = pSubq->pEList;
  4370   4370         pNew = substExpr(&x, pNew);
  4371   4371         if( pSubq->selFlags & SF_Aggregate ){
  4372         -        pSubq->pHaving = sqlite3ExprAnd(pParse->db, pSubq->pHaving, pNew);
         4372  +        pSubq->pHaving = sqlite3ExprAnd(pParse, pSubq->pHaving, pNew);
  4373   4373         }else{
  4374         -        pSubq->pWhere = sqlite3ExprAnd(pParse->db, pSubq->pWhere, pNew);
         4374  +        pSubq->pWhere = sqlite3ExprAnd(pParse, pSubq->pWhere, pNew);
  4375   4375         }
  4376   4376         pSubq = pSubq->pPrior;
  4377   4377       }
  4378   4378     }
  4379   4379     return nChng;
  4380   4380   }
  4381   4381   #endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */
................................................................................
  4793   4793     }
  4794   4794     while( pSel->pPrior ){ pSel = pSel->pPrior; }
  4795   4795     sqlite3ColumnsFromExprList(pParse, pSel->pEList,&pTab->nCol,&pTab->aCol);
  4796   4796     pTab->iPKey = -1;
  4797   4797     pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
  4798   4798     pTab->tabFlags |= TF_Ephemeral;
  4799   4799   
  4800         -  return SQLITE_OK;
         4800  +  return pParse->nErr ? SQLITE_ERROR : SQLITE_OK;
  4801   4801   }
  4802   4802   
  4803   4803   /*
  4804   4804   ** This routine is a Walker callback for "expanding" a SELECT statement.
  4805   4805   ** "Expanding" means to do the following:
  4806   4806   **
  4807   4807   **    (1)  Make sure VDBE cursor numbers have been assigned to every
................................................................................
  5414   5414       Select *pS = pWalker->u.pSelect;
  5415   5415       if( sqlite3ExprIsConstantOrGroupBy(pWalker->pParse, pExpr, pS->pGroupBy) ){
  5416   5416         sqlite3 *db = pWalker->pParse->db;
  5417   5417         Expr *pNew = sqlite3ExprAlloc(db, TK_INTEGER, &sqlite3IntTokens[1], 0);
  5418   5418         if( pNew ){
  5419   5419           Expr *pWhere = pS->pWhere;
  5420   5420           SWAP(Expr, *pNew, *pExpr);
  5421         -        pNew = sqlite3ExprAnd(db, pWhere, pNew);
         5421  +        pNew = sqlite3ExprAnd(pWalker->pParse, pWhere, pNew);
  5422   5422           pS->pWhere = pNew;
  5423   5423           pWalker->eCode = 1;
  5424   5424         }
  5425   5425       }
  5426   5426       return WRC_Prune;
  5427   5427     }
  5428   5428     return WRC_Continue;

Changes to src/shell.c.in.

  3488   3488     ".databases               List names and files of attached databases",
  3489   3489     ".dbconfig ?op? ?val?     List or change sqlite3_db_config() options",
  3490   3490     ".dbinfo ?DB?             Show status information about the database",
  3491   3491     ".dump ?TABLE? ...        Render all database content as SQL",
  3492   3492     "   Options:",
  3493   3493     "     --preserve-rowids      Include ROWID values in the output",
  3494   3494     "     --newlines             Allow unescaped newline characters in output",
  3495         -  "   TABLE is LIKE pattern for the tables to dump",
         3495  +  "   TABLE is a LIKE pattern for the tables to dump",
  3496   3496     ".echo on|off             Turn command echo on or off",
  3497   3497     ".eqp on|off|full|...     Enable or disable automatic EXPLAIN QUERY PLAN",
  3498   3498     "   Other Modes:",
  3499   3499   #ifdef SQLITE_DEBUG
  3500   3500     "      test                  Show raw EXPLAIN QUERY PLAN output",
  3501   3501     "      trace                 Like \"full\" but also enable \"PRAGMA vdbe_trace\"",
  3502   3502   #endif
................................................................................
  3857   3857     int nLine;
  3858   3858     int n = 0;
  3859   3859     int pgsz = 0;
  3860   3860     int iOffset = 0;
  3861   3861     int j, k;
  3862   3862     int rc;
  3863   3863     FILE *in;
  3864         -  unsigned char x[16];
         3864  +  unsigned int x[16];
  3865   3865     char zLine[1000];
  3866   3866     if( p->zDbFilename ){
  3867   3867       in = fopen(p->zDbFilename, "r");
  3868   3868       if( in==0 ){
  3869   3869         utf8_printf(stderr, "cannot open \"%s\" for reading\n", p->zDbFilename);
  3870   3870         return 0;
  3871   3871       }
................................................................................
  3895   3895       if( rc==2 ){
  3896   3896         iOffset = k;
  3897   3897         continue;
  3898   3898       }
  3899   3899       if( strncmp(zLine, "| end ", 6)==0 ){
  3900   3900         break;
  3901   3901       }
  3902         -    rc = sscanf(zLine,"| %d: %hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx"
  3903         -                      "  %hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx",
         3902  +    rc = sscanf(zLine,"| %d: %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x",
  3904   3903                   &j, &x[0], &x[1], &x[2], &x[3], &x[4], &x[5], &x[6], &x[7],
  3905   3904                   &x[8], &x[9], &x[10], &x[11], &x[12], &x[13], &x[14], &x[15]);
  3906   3905       if( rc==17 ){
  3907   3906         k = iOffset+j;
  3908   3907         if( k+16<=n ){
  3909         -        memcpy(a+k, x, 16);
         3908  +        int ii;
         3909  +        for(ii=0; ii<16; ii++) a[k+ii] = x[ii]&0xff;
  3910   3910         }
  3911   3911       }
  3912   3912     }
  3913   3913     *pnData = n;
  3914   3914     if( in!=p->in ){
  3915   3915       fclose(in);
  3916   3916     }else{

Changes to src/sqliteInt.h.

  2526   2526   #define EP_Subquery  0x200000 /* Tree contains a TK_SELECT operator */
  2527   2527   #define EP_Alias     0x400000 /* Is an alias for a result set column */
  2528   2528   #define EP_Leaf      0x800000 /* Expr.pLeft, .pRight, .u.pSelect all NULL */
  2529   2529   #define EP_WinFunc  0x1000000 /* TK_FUNCTION with Expr.y.pWin set */
  2530   2530   #define EP_Subrtn   0x2000000 /* Uses Expr.y.sub. TK_IN, _SELECT, or _EXISTS */
  2531   2531   #define EP_Quoted   0x4000000 /* TK_ID was originally quoted */
  2532   2532   #define EP_Static   0x8000000 /* Held in memory not obtained from malloc() */
         2533  +#define EP_IsTrue  0x10000000 /* Always has boolean value of TRUE */
         2534  +#define EP_IsFalse 0x20000000 /* Always has boolean value of FALSE */
  2533   2535   
  2534   2536   /*
  2535   2537   ** The EP_Propagate mask is a set of properties that automatically propagate
  2536   2538   ** upwards into parent nodes.
  2537   2539   */
  2538   2540   #define EP_Propagate (EP_Collate|EP_Subquery|EP_HasFunc)
  2539   2541   
................................................................................
  2541   2543   ** These macros can be used to test, set, or clear bits in the
  2542   2544   ** Expr.flags field.
  2543   2545   */
  2544   2546   #define ExprHasProperty(E,P)     (((E)->flags&(P))!=0)
  2545   2547   #define ExprHasAllProperty(E,P)  (((E)->flags&(P))==(P))
  2546   2548   #define ExprSetProperty(E,P)     (E)->flags|=(P)
  2547   2549   #define ExprClearProperty(E,P)   (E)->flags&=~(P)
         2550  +#define ExprAlwaysTrue(E)   (((E)->flags&(EP_FromJoin|EP_IsTrue))==EP_IsTrue)
         2551  +#define ExprAlwaysFalse(E)  (((E)->flags&(EP_FromJoin|EP_IsFalse))==EP_IsFalse)
  2548   2552   
  2549   2553   /* The ExprSetVVAProperty() macro is used for Verification, Validation,
  2550   2554   ** and Accreditation only.  It works like ExprSetProperty() during VVA
  2551   2555   ** processes but is a no-op for delivery.
  2552   2556   */
  2553   2557   #ifdef SQLITE_DEBUG
  2554   2558   # define ExprSetVVAProperty(E,P)  (E)->flags|=(P)
................................................................................
  3850   3854   int sqlite3NoTempsInRange(Parse*,int,int);
  3851   3855   #endif
  3852   3856   Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int);
  3853   3857   Expr *sqlite3Expr(sqlite3*,int,const char*);
  3854   3858   void sqlite3ExprAttachSubtrees(sqlite3*,Expr*,Expr*,Expr*);
  3855   3859   Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*);
  3856   3860   void sqlite3PExprAddSelect(Parse*, Expr*, Select*);
  3857         -Expr *sqlite3ExprAnd(sqlite3*,Expr*, Expr*);
         3861  +Expr *sqlite3ExprAnd(Parse*,Expr*, Expr*);
         3862  +Expr *sqlite3ExprSimplifiedAndOr(Expr*);
  3858   3863   Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*, int);
  3859   3864   void sqlite3ExprAssignVarNumber(Parse*, Expr*, u32);
  3860   3865   void sqlite3ExprDelete(sqlite3*, Expr*);
  3861   3866   ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*);
  3862   3867   ExprList *sqlite3ExprListAppendVector(Parse*,ExprList*,IdList*,Expr*);
  3863   3868   void sqlite3ExprListSetSortOrder(ExprList*,int);
  3864   3869   void sqlite3ExprListSetName(Parse*,ExprList*,Token*,int);

Changes to src/test1.c.

  7695   7695     unsigned char *a = 0;
  7696   7696     int n = 0;
  7697   7697     int lineno = 0;
  7698   7698     int i, iNext;
  7699   7699     int iOffset = 0;
  7700   7700     int j, k;
  7701   7701     int rc;
  7702         -  unsigned char x[16];
         7702  +  unsigned int x[16];
  7703   7703     if( objc!=2 ){
  7704   7704       Tcl_WrongNumArgs(interp, 1, objv, "HEXDB");
  7705   7705       return TCL_ERROR;
  7706   7706     }
  7707   7707     zIn = Tcl_GetString(objv[1]);
  7708   7708     for(i=0; zIn[i]; i=iNext){
  7709   7709       lineno++;
................................................................................
  7727   7727         continue;
  7728   7728       }
  7729   7729       rc = sscanf(zIn+i, "| page %d offset %d", &j, &k);
  7730   7730       if( rc==2 ){
  7731   7731         iOffset = k;
  7732   7732         continue;
  7733   7733       }
  7734         -    rc = sscanf(zIn+i,"| %d: %hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx"
  7735         -                      "  %hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx",
         7734  +    rc = sscanf(zIn+i,"| %d: %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x",
  7736   7735                   &j, &x[0], &x[1], &x[2], &x[3], &x[4], &x[5], &x[6], &x[7],
  7737   7736                   &x[8], &x[9], &x[10], &x[11], &x[12], &x[13], &x[14], &x[15]);
  7738   7737       if( rc==17 ){
  7739   7738         k = iOffset+j;
  7740   7739         if( k+16<=n ){
  7741         -        memcpy(a+k, x, 16);
         7740  +        int ii;
         7741  +        for(ii=0; ii<16; ii++) a[k+ii] = x[ii]&0xff;
  7742   7742         }
  7743   7743         continue;
  7744   7744       }
  7745   7745     }
  7746   7746     Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(a, n));
  7747   7747     free(a);
  7748   7748     return TCL_OK;

Changes to src/util.c.

   914    914   /*
   915    915   ** Read a 64-bit variable-length integer from memory starting at p[0].
   916    916   ** Return the number of bytes read.  The value is stored in *v.
   917    917   */
   918    918   u8 sqlite3GetVarint(const unsigned char *p, u64 *v){
   919    919     u32 a,b,s;
   920    920   
   921         -  a = *p;
   922         -  /* a: p0 (unmasked) */
   923         -  if (!(a&0x80))
   924         -  {
   925         -    *v = a;
          921  +  if( ((signed char*)p)[0]>=0 ){
          922  +    *v = *p;
   926    923       return 1;
   927    924     }
   928         -
   929         -  p++;
   930         -  b = *p;
   931         -  /* b: p1 (unmasked) */
   932         -  if (!(b&0x80))
   933         -  {
   934         -    a &= 0x7f;
   935         -    a = a<<7;
   936         -    a |= b;
   937         -    *v = a;
          925  +  if( ((signed char*)p)[1]>=0 ){
          926  +    *v = ((u32)(p[0]&0x7f)<<7) | p[1];
   938    927       return 2;
   939    928     }
   940    929   
   941    930     /* Verify that constants are precomputed correctly */
   942    931     assert( SLOT_2_0 == ((0x7f<<14) | (0x7f)) );
   943    932     assert( SLOT_4_2_0 == ((0xfU<<28) | (0x7f<<14) | (0x7f)) );
   944    933   
   945         -  p++;
   946         -  a = a<<14;
          934  +  a = ((u32)p[0])<<14;
          935  +  b = p[1];
          936  +  p += 2;
   947    937     a |= *p;
   948    938     /* a: p0<<14 | p2 (unmasked) */
   949    939     if (!(a&0x80))
   950    940     {
   951    941       a &= SLOT_2_0;
   952    942       b &= 0x7f;
   953    943       b = b<<7;

Changes to src/vacuum.c.

   102    102   ** transient would cause the database file to appear to be deleted
   103    103   ** following reboot.
   104    104   */
   105    105   void sqlite3Vacuum(Parse *pParse, Token *pNm, Expr *pInto){
   106    106     Vdbe *v = sqlite3GetVdbe(pParse);
   107    107     int iDb = 0;
   108    108     if( v==0 ) goto build_vacuum_end;
          109  +  if( pParse->nErr ) goto build_vacuum_end;
   109    110     if( pNm ){
   110    111   #ifndef SQLITE_BUG_COMPATIBLE_20160819
   111    112       /* Default behavior:  Report an error if the argument to VACUUM is
   112    113       ** not recognized */
   113    114       iDb = sqlite3TwoPartName(pParse, pNm, pNm, &pNm);
   114    115       if( iDb<0 ) goto build_vacuum_end;
   115    116   #else

Changes to src/vdbemem.c.

  1507   1507           pVal->u.i = -pVal->u.i;
  1508   1508         }
  1509   1509         sqlite3ValueApplyAffinity(pVal, affinity, enc);
  1510   1510       }
  1511   1511     }else if( op==TK_NULL ){
  1512   1512       pVal = valueNew(db, pCtx);
  1513   1513       if( pVal==0 ) goto no_mem;
  1514         -    sqlite3VdbeMemNumerify(pVal);
         1514  +    sqlite3VdbeMemSetNull(pVal);
  1515   1515     }
  1516   1516   #ifndef SQLITE_OMIT_BLOB_LITERAL
  1517   1517     else if( op==TK_BLOB ){
  1518   1518       int nVal;
  1519   1519       assert( pExpr->u.zToken[0]=='x' || pExpr->u.zToken[0]=='X' );
  1520   1520       assert( pExpr->u.zToken[1]=='\'' );
  1521   1521       pVal = valueNew(db, pCtx);

Changes to src/wal.c.

  2904   2904   
  2905   2905       rc = walHashGet(pWal, iHash, &sLoc);
  2906   2906       if( rc!=SQLITE_OK ){
  2907   2907         return rc;
  2908   2908       }
  2909   2909       nCollide = HASHTABLE_NSLOT;
  2910   2910       for(iKey=walHash(pgno); sLoc.aHash[iKey]; iKey=walNextHash(iKey)){
  2911         -      u32 iFrame = sLoc.aHash[iKey] + sLoc.iZero;
  2912         -      if( iFrame<=iLast && iFrame>=pWal->minFrame
  2913         -       && sLoc.aPgno[sLoc.aHash[iKey]]==pgno ){
         2911  +      u32 iH = sLoc.aHash[iKey];
         2912  +      u32 iFrame = iH + sLoc.iZero;
         2913  +      if( iFrame<=iLast && iFrame>=pWal->minFrame && sLoc.aPgno[iH]==pgno ){
  2914   2914           assert( iFrame>iRead || CORRUPT_DB );
  2915   2915           iRead = iFrame;
  2916   2916         }
  2917   2917         if( (nCollide--)==0 ){
  2918   2918           return SQLITE_CORRUPT_BKPT;
  2919   2919         }
  2920   2920       }

Changes to src/where.c.

   733    733       assert( !ExprHasProperty(pExpr, EP_FromJoin)    /* prereq always non-zero */
   734    734            || pExpr->iRightJoinTable!=pSrc->iCursor   /*   for the right-hand   */
   735    735            || pLoop->prereq!=0 );                     /*   table of a LEFT JOIN */
   736    736       if( pLoop->prereq==0
   737    737        && (pTerm->wtFlags & TERM_VIRTUAL)==0
   738    738        && !ExprHasProperty(pExpr, EP_FromJoin)
   739    739        && sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){
   740         -      pPartial = sqlite3ExprAnd(pParse->db, pPartial,
          740  +      pPartial = sqlite3ExprAnd(pParse, pPartial,
   741    741                                   sqlite3ExprDup(pParse->db, pExpr, 0));
   742    742       }
   743    743       if( termCanDriveIndex(pTerm, pSrc, notReady) ){
   744    744         int iCol = pTerm->u.leftColumn;
   745    745         Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
   746    746         testcase( iCol==BMS );
   747    747         testcase( iCol==BMS-1 );

Changes to src/wherecode.c.

   995    995         sWalker.eCode = 0;
   996    996         sWalker.xExprCallback = codeCursorHintCheckExpr;
   997    997         sqlite3WalkExpr(&sWalker, pTerm->pExpr);
   998    998         if( sWalker.eCode ) continue;
   999    999       }
  1000   1000   
  1001   1001       /* If we survive all prior tests, that means this term is worth hinting */
  1002         -    pExpr = sqlite3ExprAnd(db, pExpr, sqlite3ExprDup(db, pTerm->pExpr, 0));
         1002  +    pExpr = sqlite3ExprAnd(pParse, pExpr, sqlite3ExprDup(db, pTerm->pExpr, 0));
  1003   1003     }
  1004   1004     if( pExpr!=0 ){
  1005   1005       sWalker.xExprCallback = codeCursorHintFixExpr;
  1006   1006       sqlite3WalkExpr(&sWalker, pExpr);
  1007   1007       sqlite3VdbeAddOp4(v, OP_CursorHint, 
  1008   1008                         (sHint.pIdx ? sHint.iIdxCur : sHint.iTabCur), 0, 0,
  1009   1009                         (const char*)pExpr, P4_EXPR);
................................................................................
  1960   1960           if( &pWC->a[iTerm] == pTerm ) continue;
  1961   1961           testcase( pWC->a[iTerm].wtFlags & TERM_VIRTUAL );
  1962   1962           testcase( pWC->a[iTerm].wtFlags & TERM_CODED );
  1963   1963           if( (pWC->a[iTerm].wtFlags & (TERM_VIRTUAL|TERM_CODED))!=0 ) continue;
  1964   1964           if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue;
  1965   1965           testcase( pWC->a[iTerm].wtFlags & TERM_ORINFO );
  1966   1966           pExpr = sqlite3ExprDup(db, pExpr, 0);
  1967         -        pAndExpr = sqlite3ExprAnd(db, pAndExpr, pExpr);
         1967  +        pAndExpr = sqlite3ExprAnd(pParse, pAndExpr, pExpr);
  1968   1968         }
  1969   1969         if( pAndExpr ){
  1970   1970           /* The extra 0x10000 bit on the opcode is masked off and does not
  1971   1971           ** become part of the new Expr.op.  However, it does make the
  1972   1972           ** op==TK_AND comparison inside of sqlite3PExpr() false, and this
  1973   1973           ** prevents sqlite3PExpr() from implementing AND short-circuit 
  1974   1974           ** optimization, which we do not want here. */

Changes to test/altertab.test.

   554    554       ALTER TABLE y1 RENAME TO z1;
   555    555     }
   556    556   
   557    557     do_execsql_test 16.4 {
   558    558       SELECT * FROM z1_segments;
   559    559     }
   560    560   }
          561  +
          562  +#-------------------------------------------------------------------------
          563  +reset_db
          564  +do_execsql_test 17.0 {
          565  +  CREATE TABLE sqlite1234 (id integer);
          566  +  ALTER TABLE sqlite1234 RENAME TO User;
          567  +  SELECT name, sql FROM sqlite_master WHERE sql IS NOT NULL;
          568  +} {
          569  +  User {CREATE TABLE "User" (id integer)}
          570  +}
   561    571   
   562    572   finish_test

Changes to test/corruptL.test.

   833    833   | end a.db
   834    834   }]} {}
   835    835   
   836    836   
   837    837   do_catchsql_test 8.1 {
   838    838     INSERT INTO t3 SELECT * FROM t2;
   839    839   } {1 {database disk image is malformed}}
          840  +
          841  +#-------------------------------------------------------------------------
          842  +reset_db
          843  +do_test 9.0 {
          844  +  sqlite3 db {}
          845  +  db deserialize [decode_hexdb {
          846  +| size 8192 pagesize 4096 filename crash-ab10597e4e1c32.db
          847  +| page 1 offset 0
          848  +|      0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00   SQLite format 3.
          849  +|     16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 00   .....@  ........
          850  +|     96: 00 00 00 00 0d 00 00 00 01 0f d6 00 0f d6 00 00   ................
          851  +|   4048: 00 00 00 00 00 00 28 01 06 17 11 11 01 3d 74 61   ......(......=ta
          852  +|   4064: 62 6c 65 74 31 74 31 02 43 52 45 41 54 45 20 54   blet1t1.CREATE T
          853  +|   4080: 41 42 4c 45 20 74 31 28 61 2c 62 2c 63 2c 64 29   ABLE t1(a,b,c,d)
          854  +| page 2 offset 4096
          855  +|      0: 0d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
          856  +| end crash-ab10597e4e1c32.db
          857  +}]} {}
          858  +
          859  +do_execsql_test 9.1 {
          860  +  SAVEPOINT one;
          861  +}
          862  +do_catchsql_test 9.3 {
          863  +  INSERT INTO t1(b,c) VALUES(5,6);
          864  +} {1 {database disk image is malformed}}
          865  +do_execsql_test 9.3 {
          866  +  ROLLBACK TO one;
          867  +}
   840    868   
   841    869   finish_test

Changes to test/fts3corrupt4.test.

  3911   3911   | end crash-670b15f2955a36.db
  3912   3912   }]} {}
  3913   3913   
  3914   3914   do_catchsql_test 23.1 {
  3915   3915     SELECT 'FyzLy'FROM t1 WHERE t1 MATCH 'j';
  3916   3916   } {1 {database disk image is malformed}}
  3917   3917   
         3918  +#-------------------------------------------------------------------------
         3919  +reset_db
         3920  +do_test 24.0 {
         3921  +  sqlite3 db {}
         3922  +  db deserialize [decode_hexdb {
         3923  +.open --hexdb
         3924  +| size 28672 pagesize 4096 filename crash-369d042958c29b.db
         3925  +| page 1 offset 0
         3926  +|      0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00   SQLite format 3.
         3927  +|     16: 10 00 01 01 00 40 20 20 00 00 03 10 00 00 00 00   .....@  ........
         3928  +|     96: 00 00 00 00 0d 0e b1 00 06 0d a4 00 0f 8d 0f 21   ...............!
         3929  +|    112: 0e b9 0d c8 0e 7e 0d a4 00 00 00 00 00 00 00 00   .....~..........
         3930  +|   3488: 00 00 00 00 22 07 06 17 11 11 01 31 74 61 62 6c   ...........1tabl
         3931  +|   3504: 65 74 32 74 32 07 43 52 45 41 54 45 20 54 41 42   et2t2.CREATE TAB
         3932  +|   3520: 4c 45 20 74 32 28 78 29 81 33 05 07 17 1f 1f 01   LE t2(x).3......
         3933  +|   3536: 82 35 74 61 62 6c 65 74 31 5f 73 65 67 64 69 72   .5tablet1_segdir
         3934  +|   3552: 74 31 5f 73 65 67 64 69 72 05 43 52 45 41 54 45   t1_segdir.CREATE
         3935  +|   3568: 20 54 41 42 4c 45 20 27 74 31 5f 73 65 67 64 69    TABLE 't1_segdi
         3936  +|   3584: 72 27 28 6c 65 76 65 6c 20 49 4e 54 45 47 45 52   r'(level INTEGER
         3937  +|   3600: 2c 69 64 78 20 49 4e 54 45 47 45 52 2c 73 74 61   ,idx INTEGER,sta
         3938  +|   3616: 72 74 5f 62 6c 6f 63 6b 20 49 4e 54 45 47 45 52   rt_block INTEGER
         3939  +|   3632: 2c 6c 65 61 76 65 73 5f 65 6e 64 5f 62 6c 6f 63   ,leaves_end_bloc
         3940  +|   3648: 6b 20 49 4e 54 45 47 45 52 2c 65 6e 64 5f 62 6c   k INTEGER,end_bl
         3941  +|   3664: 6f 63 6b 20 49 4e 54 45 47 45 52 2c 72 6f 6f 74   ock INTEGER,root
         3942  +|   3680: 20 42 4c 4f 42 2c 50 52 49 4d 41 52 59 20 4b 45    BLOB,PRIMARY KE
         3943  +|   3696: 59 28 6c 65 76 65 6c 2c 20 69 64 78 29 29 31 06   Y(level, idx))1.
         3944  +|   3712: 06 17 45 1f 01 00 69 6e 64 65 78 73 71 6c 69 74   ..E...indexsqlit
         3945  +|   3728: 65 5f 61 75 74 6f 69 6e 64 65 78 5f 74 31 5f 73   e_autoindex_t1_s
         3946  +|   3744: 65 67 64 69 72 5f 31 74 31 5f 73 65 67 64 69 72   egdir_1t1_segdir
         3947  +|   3760: 06 0f c7 00 08 00 10 00 00 66 04 07 17 23 23 01   .........f...##.
         3948  +|   3776: 81 13 74 61 62 6c 65 74 31 5f 73 65 67 6d 65 6e   ..tablet1_segmen
         3949  +|   3792: 64 73 74 31 5f 73 65 67 6d 65 6e 74 73 04 43 52   dst1_segments.CR
         3950  +|   3808: 45 41 54 45 20 54 41 42 4c 45 20 27 74 31 5f 73   EATE TABLE 't1_s
         3951  +|   3824: 65 67 6d 65 6e 74 73 27 28 62 6c 6f 63 6b 69 64   egments'(blockid
         3952  +|   3840: 20 49 4e 54 45 47 45 52 20 50 52 49 4d 41 52 59    INTEGER PRIMARY
         3953  +|   3856: 20 4b 45 59 2c 20 62 6c 6f 63 6b 20 42 4c 4f 42    KEY, block BLOB
         3954  +|   3872: 29 6a 03 07 17 21 21 01 81 1f 74 61 62 6c 65 74   )j...!!...tablet
         3955  +|   3888: 31 4f 63 6f 6e 74 65 6e 74 74 31 5f 63 6f 6e 74   1Ocontentt1_cont
         3956  +|   3904: 65 6e 74 03 43 52 45 41 54 45 20 54 41 42 4c 45   ent.CREATE TABLE
         3957  +|   3920: 20 27 74 31 5f 63 6f 6e 74 65 6e 74 27 28 64 6f    't1_content'(do
         3958  +|   3936: 63 69 64 20 49 4e 54 45 47 45 52 20 50 52 39 4d   cid INTEGER PR9M
         3959  +|   3952: 41 52 59 20 4b 45 59 2c 20 27 63 30 61 27 2c 20   ARY KEY, 'c0a', 
         3960  +|   3968: 27 63 31 62 27 2c 20 27 63 32 63 27 29 38 02 06   'c1b', 'c2c')8..
         3961  +|   3984: 17 11 11 08 5f 74 61 62 6c 65 74 31 74 31 43 52   ...._tablet1t1CR
         3962  +|   4000: 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42   EATE VIRTUAL TAB
         3963  +|   4016: 4c 45 20 74 31 20 55 53 49 4e 47 20 66 74 73 33   LE t1 USING fts3
         3964  +|   4032: 28 61 2c 62 2c 63 29 00 00 00 00 00 00 00 00 00   (a,b,c).........
         3965  +| page 3 offset 8192
         3966  +|      0: 0d 00 00 00 26 0b 48 0e 0f d8 0f af 0f 86 0f 74   ....&.H........t
         3967  +|     16: 0f 61 0f 4e 0f 2f 0f 0f 0e ef 0e d7 0e be 0e a5   .a.N./..........
         3968  +|     32: 0e 8d 0e 74 0e 5b 0e 40 0e 24 0e 08 0d ef 0d d5   ...t.[.@.$......
         3969  +|     48: 0d bb 0d a0 0e 94 03 28 0d 4f 0d 35 0d 1b 05 0b   .......(.O.5....
         3970  +|     64: 0c da 0c b9 0c 99 0c 78 0c 57 0c 3e 0c 24 0c 0a   .......x.W.>.$..
         3971  +|   2880: 00 00 00 00 00 00 00 00 81 3f 25 06 00 72 7f 00   .........?%..r..
         3972  +|   2896: 00 43 4f 4d 50 49 4c 45 52 3d 67 63 63 2d 35 2e   .COMPILER=gcc-5.
         3973  +|   2912: 34 2e 30 20 32 30 31 36 30 36 30 39 20 44 55 42   4.0 20160609 DUB
         3974  +|   2928: 55 47 20 45 4e 41 e4 7c 45 20 44 42 53 54 41 54   UG ENA.|E DBSTAT
         3975  +|   2944: e4 d1 54 41 42 20 45 4e 41 42 4c 45 20 46 54 53   ..TAB ENABLE FTS
         3976  +|   2960: 34 20 45 4e 41 42 4c 45 20 46 54 53 35 20 45 4e   4 ENABLE FTS5 EN
         3977  +|   2976: 41 42 4c 45 20 47 45 4f 50 4f 4c 59 20 45 4e 41   ABLE GEOPOLY ENA
         3978  +|   2992: 42 4c 45 20 4a 53 4f 4e 31 20 45 4e 41 42 4c 45   BLE JSON1 ENABLE
         3979  +|   3008: 20 4d 45 4d 53 59 53 35 20 45 4e 41 42 4c 45 20    MEMSYS5 ENABLE 
         3980  +|   3024: 42 54 52 45 45 20 4d 41 58 20 4d 45 4d 4f 52 59   BTREE MAX MEMORY
         3981  +|   3040: 3d 35 30 30 30 30 30 30 30 20 4f 4c 49 54 20 4c   =50000000 OLIT L
         3982  +|   3056: 4f 41 43 20 45 58 54 45 4e 53 49 4f 4e 21 54 48   OAC EXTENSION!TH
         3983  +|   3072: 52 45 41 44 53 41 46 45 3d 30 18 24 05 00 25 0f   READSAFE=0.$..%.
         3984  +|   3088: 19 54 48 52 45 41 44 53 41 46 45 3d 30 58 42 49   .THREADSAFE=0XBI
         3985  +|   3104: 4e 41 52 59 18 23 05 00 25 0f 19 54 48 52 45 41   NARY.#..%..THREA
         3986  +|   3120: 44 53 41 4b 75 3d 30 58 4d 4f 43 41 53 45 17 22   DSAKu=0XMOCASE..
         3987  +|   3136: 05 00 25 0f 17 54 48 52 45 41 44 53 41 46 46 3d   ..%..THREADSAFF=
         3988  +|   3152: 30 58 52 54 52 49 4d 1f 21 05 00 33 0f 19 4f 4d   0XRTRIM.!..3..OM
         3989  +|   3168: 49 54 20 4c 4f 41 44 20 45 58 54 45 4e 52 49 4f   IT LOAD EXTENRIO
         3990  +|   3184: 4e 58 42 49 4e 41 52 59 1f 20 05 00 33 0f 19 4f   NXBINARY. ..3..O
         3991  +|   3200: 4d 49 54 20 4c 4f 41 44 20 45 58 54 45 4e 53 49   MIT LOAD EXTENSI
         3992  +|   3216: 4f 4e 58 4e 4f 43 41 53 45 1e 1f 05 00 33 0f 17   ONXNOCASE....3..
         3993  +|   3232: 4f 4d 49 54 20 4c 4f 41 44 20 45 58 54 45 4e 53   OMIT LOAD EXTENS
         3994  +|   3248: 49 4f 4e 58 52 54 52 49 4d 1f 1e 05 00 33 0f 19   IONXRTRIM....3..
         3995  +|   3264: 4d 41 58 20 4d 45 4d 4f 52 59 3d 35 30 30 30 30   MAX MEMORY=50000
         3996  +|   3280: 30 30 30 58 42 49 4e 41 52 59 1f 1d 05 00 33 0f   000XBINARY....3.
         3997  +|   3296: 19 4d 41 58 20 4d 45 4d 4f 52 59 3d 35 30 30 30   .MAX MEMORY=5000
         3998  +|   3312: 30 30 30 30 58 4e 4f 43 41 53 45 1e 1c 05 00 33   0000XNOCASE....3
         3999  +|   3328: 0f 17 4d 42 b8 20 4d 45 4d 4f 52 59 3d 35 30 30   ..MB. MEMORY=500
         4000  +|   3344: 30 30 30 30 30 58 52 54 52 49 4d 18 1b 05 00 25   00000XRTRIM....%
         4001  +|   3360: 0f 19 45 4e 41 42 4c 45 20 52 54 52 45 45 58 42   ..ENABLE RTREEXB
         4002  +|   3376: 49 4e 41 52 59 18 1a 05 0d a5 0f 19 45 4e 41 42   INARY.......ENAB
         4003  +|   3392: 4c 45 20 52 54 52 45 45 58 4e 4f 43 41 53 45 17   LE RTREEXNOCASE.
         4004  +|   3408: 19 1c 00 25 0f 17 45 4e 41 42 4c 45 20 52 54 52   ...%..ENABLE RTR
         4005  +|   3424: 45 45 58 52 54 52 49 4d 1a 18 05 00 29 0f 19 45   EEXRTRIM....)..E
         4006  +|   3440: 4e 41 42 4c 45 20 4d 45 4d 53 59 53 35 58 42 49   NABLE MEMSYS5XBI
         4007  +|   3456: 4e 41 52 59 1a 17 05 00 29 0f 19 45 4e 41 42 4c   NARY....)..ENABL
         4008  +|   3472: 45 20 4d 45 4d 53 59 53 35 58 4e 4f 43 41 53 45   E MEMSYS5XNOCASE
         4009  +|   3488: 19 16 05 00 29 0f 17 45 4e 41 42 4c 45 20 4d 45   ....)..ENABLE ME
         4010  +|   3504: 4d 53 59 53 35 58 52 54 52 49 4d 18 14 05 01 25   MSYS5XRTRIM....%
         4011  +|   3520: 0f 19 45 4e 12 42 4c 45 20 4a 53 4f 4e 31 58 42   ..EN.BLE JSON1XB
         4012  +|   3536: 49 4e 41 52 59 18 14 05 00 25 09 d9 45 4e 41 42   INARY....%..ENAB
         4013  +|   3552: 4c 45 20 4a 53 4f 3e 31 58 4e 4f 43 41 53 45 17   LE JSO>1XNOCASE.
         4014  +|   3568: 13 05 00 25 0f 17 45 4e 40 42 4c 45 20 4a 53 4f   ...%..EN@BLE JSO
         4015  +|   3584: 4e 31 58 52 54 52 49 4d 1a 12 05 82 29 0f 19 45   N1XRTRIM....)..E
         4016  +|   3600: 4e 41 42 4c 45 20 47 45 4f 50 4f 4c 59 58 42 49   NABLE GEOPOLYXBI
         4017  +|   3616: 4e 41 52 59 1a 11 05 c9 29 e8 19 46 4e 41 42 4c   NARY....)..FNABL
         4018  +|   3632: 48 c0 47 45 4f 50 4f 4c 59 58 4e 74 43 41 53 45   H.GEOPOLYXNtCASE
         4019  +|   3648: 19 10 05 00 29 0f 17 45 4e 41 42 4c 45 20 47 45   ....)..ENABLE GE
         4020  +|   3664: 4f 50 4f 4c 59 58 52 54 52 49 4d 17 0f 05 00 23   OPOLYXRTRIM....#
         4021  +|   3680: 0f 19 45 4e 41 42 4c 45 30 46 54 53 35 58 42 49   ..ENABLE0FTS5XBI
         4022  +|   3696: 4e 41 52 59 17 0e 05 00 23 0f 19 45 4e 41 42 4c   NARY....#..ENABL
         4023  +|   3712: 45 20 46 54 53 35 58 4e 4f 43 41 53 45 16 0e 05   E FTS5XNOCASE...
         4024  +|   3728: 00 23 0f 17 45 4e 41 42 4c 45 20 46 54 53 35 58   .#..ENABLE FTS5X
         4025  +|   3744: 52 54 52 49 4d 17 0c 05 00 23 0f 19 45 4e 41 42   RTRIM....#..ENAB
         4026  +|   3760: 4c 45 20 46 54 53 34 58 42 49 4e 41 52 59 17 0b   LE FTS4XBINARY..
         4027  +|   3776: 05 00 23 0f 19 45 4e 41 42 4c 45 20 46 54 53 34   ..#..ENABLE FTS4
         4028  +|   3792: 58 4e 4f 43 41 53 45 16 0a 05 00 23 0f 17 45 4e   XNOCASE....#..EN
         4029  +|   3808: 41 42 4c 45 20 46 54 53 34 58 52 54 52 49 4d 1e   ABLE FTS4XRTRIM.
         4030  +|   3824: 09 05 00 31 0f 19 45 4e 42 42 4c 45 20 44 42 53   ...1..ENBBLE DBS
         4031  +|   3840: 54 41 54 20 56 54 41 42 58 42 49 4e 41 52 59 1e   TAT VTABXBINARY.
         4032  +|   3856: 08 05 00 31 0f 19 45 4e 41 42 4c 45 20 44 42 53   ...1..ENABLE DBS
         4033  +|   3872: 54 41 54 20 56 54 41 42 58 4e 4f 43 41 53 45 1d   TAT VTABXNOCASE.
         4034  +|   3888: 07 05 00 31 0f 17 45 4e 41 42 4c 45 20 44 42 53   ...1..ENABLE DBS
         4035  +|   3904: 54 41 54 20 56 54 41 42 58 52 54 52 4a 4d 11 06   TAT VTABXRTRJM..
         4036  +|   3920: 05 f0 17 0f 19 44 45 42 55 47 58 42 49 4e 41 52   .....DEBUGXBINAR
         4037  +|   3936: 59 11 05 05 00 17 0e 19 44 45 42 55 47 58 4e 4f   Y.......DEBUGXNO
         4038  +|   3952: 43 41 53 45 10 04 05 00 17 0f 16 44 45 42 55 47   CASE.......DEBUG
         4039  +|   3968: 58 52 54 52 49 4d 27 03 05 00 43 0f 19 43 4f 4d   XRTRIM'...C..COM
         4040  +|   3984: 50 49 4c 45 52 3d 67 63 63 2d 35 2e 34 2e 30 20   PILER=gcc-5.4.0 
         4041  +|   4000: 32 30 31 36 30 36 30 39 58 42 49 4e 41 52 59 27   20160609XBINARY'
         4042  +|   4016: 02 05 00 43 0f 19 43 4f 4d 50 49 4c 45 52 3d 67   ...C..COMPILER=g
         4043  +|   4032: 63 63 2d 35 2e 34 2e 30 20 32 30 31 36 30 36 30   cc-5.4.0 2016060
         4044  +|   4048: 39 58 4e 4f 43 41 53 45 26 01 06 00 43 0f 17 43   9XNOCASE&...C..C
         4045  +|   4064: 4f 4d 50 49 4b 45 52 3d 67 63 63 2d 35 2e 34 2e   OMPIKER=gcc-5.4.
         4046  +|   4080: 30 20 32 30 31 36 30 36 40 39 58 29 54 52 49 4d   0 201606@9X)TRIM
         4047  +| page 4 offset 12288
         4048  +|      0: 0d 00 10 00 00 10 00 00 00 00 00 00 00 01 00 00   ................
         4049  +| page 5 offset 16384
         4050  +|      0: 0d 00 00 00 02 0b a0 00 0c ad 0b a0 00 00 00 00   ................
         4051  +|   2976: 82 0a 02 08 08 09 08 08 17 84 06 30 20 32 35 33   ...........0 253
         4052  +|   2992: 00 01 30 04 25 06 1b 00 00 08 32 30 31 36 30 36   ..0.%.....201606
         4053  +|   3008: 30 39 03 25 07 00 00 01 34 03 25 05 00 00 01 35   09.%....4.%....5
         4054  +|   3024: 03 25 04 00 01 07 30 30 30 30 30 30 30 03 25 1a   .%....0000000.%.
         4055  +|   3040: 00 00 08 63 6f 6d 70 69 6c 65 72 03 25 02 00 00   ...compiler.%...
         4056  +|   3056: 06 64 62 73 74 61 74 03 25 0a 00 01 04 65 62 75   .dbstat.%....ebu
         4057  +|   3072: 67 03 25 08 00 00 06 65 6e 61 62 6c 65 09 25 09   g.%....enable.%.
         4058  +|   3088: 05 04 04 04 04 04 00 01 08 78 74 65 6e 73 69 6f   .........xtensio
         4059  +|   3104: 6e 03 25 1d 00 00 04 66 74 73 34 03 25 0d 00 03   n.%....fts4.%...
         4060  +|   3120: 01 35 03 25 0f 00 00 03 67 63 63 03 25 03 00 01   .5.%....gcc.%...
         4061  +|   3136: 06 65 6f 70 6f 6c 79 03 25 11 00 00 05 6a 73 6f   .eopoly.%....jso
         4062  +|   3152: 6e 31 03 25 13 00 00 04 6c 6f 61 64 03 25 1c 00   n1.%....load.%..
         4063  +|   3168: 00 03 6d 61 78 03 25 18 00 01 05 65 6e 6f 72 79   ..max.%....enory
         4064  +|   3184: 03 25 19 00 03 04 ce 79 73 4d 03 25 15 00 00 04   .%.....ysM.%....
         4065  +|   3200: 6f 6d 69 74 03 25 1b 00 00 05 72 74 72 65 65 03   omit.%....rtree.
         4066  +|   3216: 25 17 00 00 0a 74 68 72 65 61 64 73 61 66 65 03   %....threadsafe.
         4067  +|   3232: 25 0e 00 00 04 76 74 61 62 03 25 0b 00 86 50 01   %....vtab.%...P.
         4068  +|   3248: 08 08 08 08 08 17 8d 12 30 20 38 33 35 00 01 30   ........0 835..0
         4069  +|   3264: 12 01 06 00 01 06 00 01 06 00 1f 03 00 01 03 09   ................
         4070  +|   3280: 51 03 00 00 08 32 30 31 36 30 36 30 39 09 01 07   Q....20160609...
         4071  +|   3296: 00 01 07 00 01 07 00 00 01 34 09 01 05 00 01 05   .........4......
         4072  +|   3312: 00 01 05 00 00 01 35 09 01 04 00 01 04 00 01 04   ......5.........
         4073  +|   3328: 00 01 07 30 30 30 30 30 30 30 09 1c 04 00 01 04   ...0000000......
         4074  +|   3344: 00 01 04 00 00 06 62 69 6e 61 72 79 3c 03 01 02   ......binary<...
         4075  +|   3360: 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02   ................
         4076  +|   3376: 00 03 01 02 02 00 02 f1 02 02 00 03 01 02 02 00   ................
         4077  +|   3392: 03 01 02 02 00 03 01 02 02 00 03 01 02 02 00 03   ................
         4078  +|   3408: 01 02 02 00 03 01 02 02 00 00 08 63 6f 6d 70 69   ...........compi
         4079  +|   3424: 6c 65 72 09 01 02 00 01 02 00 01 02 00 00 06 67   ler............g
         4080  +|   3440: d2 73 74 61 74 09 07 03 00 01 03 00 01 03 00 01   .stat...........
         4081  +|   3456: 04 65 62 75 67 09 04 02 00 01 02 00 01 02 00 00   .ebug...........
         4082  +|   3472: 06 65 6e 6f 82 6c 65 3f 07 02 00 01 02 00 01 02   .eno.le?........
         4083  +|   3488: b0 01 02 00 01 02 00 11 02 00 01 02 00 01 02 00   ................
         4084  +|   3504: 01 02 00 01 02 00 01 02 00 01 a6 00 01 02 00 01   ................
         4085  +|   3520: 02 05 51 02 00 01 02 00 01 02 00 01 02 00 01 02   ..Q.............
         4086  +|   3536: 00 01 02 00 01 02 00 01 08 78 74 65 6e 73 69 6f   .........xtensio
         4087  +|   3552: 6e 09 1f 04 00 01 04 00 00 04 00 00 04 66 74 73   n............fts
         4088  +|   3568: 34 09 0a 03 00 01 03 00 01 03 00 03 01 35 09 0d   4............5..
         4089  +|   3584: 03 00 01 03 00 01 03 00 00 03 67 63 63 09 01 03   ..........gcc...
         4090  +|   3600: 00 01 03 00 01 03 00 01 06 65 6f 70 73 6c 79 09   .........eopsly.
         4091  +|   3616: 10 03 00 01 03 00 01 03 00 00 05 6a 73 6f 6e 31   ...........json1
         4092  +|   3632: 09 13 03 00 01 03 00 01 03 00 00 04 6c 6f 61 64   ............load
         4093  +|   3648: 09 1f 03 00 01 03 00 01 03 00 00 03 6d 61 78 09   ............max.
         4094  +|   3664: 1c 02 00 01 02 00 01 02 00 01 05 65 6d 6f 72 79   ...........emory
         4095  +|   3680: 09 1c 03 00 01 03 00 01 03 00 03 04 73 79 73 35   ............sys5
         4096  +|   3696: 09 16 03 00 01 03 00 01 03 00 00 06 6e 6f 63 61   ............noca
         4097  +|   3712: 73 65 3c 02 01 02 02 00 03 01 12 02 00 03 01 02   se<.............
         4098  +|   3728: 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02   ................
         4099  +|   3744: 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02 00   ................
         4100  +|   3760: 03 01 02 02 00 03 01 02 02 00 03 01 02 02 00 00   ................
         4101  +|   3776: 04 6f 6d 69 74 09 1f 02 00 01 02 00 01 02 00 00   .omit...........
         4102  +|   3792: 05 72 74 72 65 65 09 19 03 00 01 03 00 01 03 00   .rtree..........
         4103  +|   3808: 03 02 69 6d 3c 01 01 02 02 00 03 01 02 02 00 03   ..im<...........
         4104  +|   3824: 01 02 02 00 03 01 02 02 00 03 01 02 02 00 03 01   ................
         4105  +|   3840: 02 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02   ................
         4106  +|   3856: 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02   ................
         4107  +|   3872: 00 00 0a 74 68 72 65 61 64 73 61 66 65 09 22 02   ...threadsafe...
         4108  +|   3888: 00 01 02 00 01 02 00 00 04 76 74 61 62 09 07 04   .........vtab...
         4109  +|   3904: 00 01 04 00 01 03 ff ff 01 78 b4 01 01 01 01 02   .........x......
         4110  +|   3920: 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00   ................
         4111  +|   3936: 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00 01   ................
         4112  +|   3952: 01 01 02 00 01 01 01 07 30 01 01 01 02 00 01 01   ........0.......
         4113  +|   3968: 01 02 00 11 01 01 02 00 01 01 01 02 00 11 01 01   ................
         4114  +|   3984: 02 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02   ................
         4115  +|   4000: 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00   ................
         4116  +|   4016: 01 01 01 01 ff 01 01 01 02 00 01 01 01 02 00 01   ................
         4117  +|   4032: 01 01 02 00 01 01 01 02 00 01 01 01 02 00 01 01   ................
         4118  +|   4048: 01 02 00 01 01 09 c2 00 01 01 01 02 00 01 01 01   ................
         4119  +|   4064: 02 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02   ................
         4120  +|   4080: 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00   ................
         4121  +| page 6 offset 20480
         4122  +|      0: 0a 00 00 00 02 0f f5 00 0f fb 0f f5 00 00 00 00   ................
         4123  +|   4080: 00 00 00 00 00 05 04 08 09 01 02 04 04 08 08 09   ................
         4124  +| page 7 offset 24576
         4125  +|      0: 0d 00 00 00 05 0f b8 00 0e f4 0f e9 10 d6 0f c7   ................
         4126  +|   4016: 00 00 00 00 00 00 00 00 0d 05 02 23 61 75 74 6f   ...........#auto
         4127  +|   4032: 6d 65 72 67 65 3d 35 0d 04 02 23 6d 65 72 67 65   merge=5...#merge
         4128  +|   4048: 3d 31 00 00 00 00 00 00 00 00 00 00 00 00 00 00   =1..............
         4129  +| end crash-369d042958c29b.db
         4130  +}]} {}
         4131  +
         4132  +do_catchsql_test 24.1 {
         4133  +  WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT '4hE'+x FROM c WHERE x<72)
         4134  +    INSERT INTO t1(a) SELECT randomblob(2829) FROM c;
         4135  +} {0 {}}
         4136  +
         4137  +do_catchsql_test 24.2 {
         4138  +  UPDATE t1 SET b=quote((true) ) WHERE t1 MATCH 'h';
         4139  +} {0 {}}
         4140  +
         4141  +do_catchsql_test 24.3 {
         4142  +  WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT 3+x FROM c WHERE x<72)
         4143  +    INSERT INTO t1(a) SELECT randomblob(2829) FROM c;
         4144  +} {0 {}}
         4145  +
         4146  +do_catchsql_test 24.4 {
         4147  +  WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT null<<x FROM c WHERE x<72)
         4148  +    INSERT INTO t1(a) SELECT randomblob(2829) FROM c;
         4149  +} {0 {}}
         4150  +
         4151  +do_catchsql_test 24.5 {
         4152  +  WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT 3+x FROM c WHERE x<72)
         4153  +    INSERT INTO t1(a) SELECT randomblob(2829) FROM c;
         4154  +} {0 {}}
         4155  +
         4156  +do_catchsql_test 24.7 {
         4157  +  INSERT INTO t1(t1) SELECT x FROM t2;
         4158  +} {1 {database disk image is malformed}}
         4159  +
         4160  +#-------------------------------------------------------------------------
         4161  +#-------------------------------------------------------------------------
         4162  +reset_db
         4163  +do_test 25.0 {
         4164  +  sqlite3 db {}
         4165  +  db deserialize [decode_hexdb {
         4166  +.open --hexdb
         4167  +| size 28672 pagesize 4096 filename crash-dde9e76ed8ab2d.db
         4168  +| page 1 offset 0
         4169  +|      0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00   SQLite format 3.
         4170  +|     16: 10 00 01 01 00 40 20 20 00 00 03 10 00 00 00 00   .....@  ........
         4171  +|     96: 00 00 00 00 0d 0e b1 00 06 0d a4 00 0f 8d 0f 21   ...............!
         4172  +|    112: 0e b9 0d c8 0e 7e 0d a4 00 00 00 00 00 00 00 00   .....~..........
         4173  +|   3488: 00 00 00 00 22 07 06 17 11 11 01 31 74 61 62 6c   ...........1tabl
         4174  +|   3504: 65 74 32 74 32 07 43 52 45 41 54 45 20 54 41 42   et2t2.CREATE TAB
         4175  +|   3520: 4c 45 20 74 32 28 78 29 81 33 05 07 17 1f 1f 01   LE t2(x).3......
         4176  +|   3536: 82 35 74 61 62 6c 65 74 31 5f 73 65 67 64 69 72   .5tablet1_segdir
         4177  +|   3552: 74 31 5f 73 65 67 64 69 72 05 43 52 45 41 54 45   t1_segdir.CREATE
         4178  +|   3568: 20 54 41 42 4c 45 20 27 74 31 5f 73 65 67 64 69    TABLE 't1_segdi
         4179  +|   3584: 72 27 28 6c 65 76 65 6c 20 49 4e 54 45 47 45 52   r'(level INTEGER
         4180  +|   3600: 2c 69 64 78 20 49 4e 54 45 47 45 52 2c 73 74 61   ,idx INTEGER,sta
         4181  +|   3616: 72 74 5f 62 6c 6f 63 6b 20 49 4e 54 45 47 45 52   rt_block INTEGER
         4182  +|   3632: 2c 6c 65 61 76 65 73 5f 65 6e 64 5f 62 6c 6f 63   ,leaves_end_bloc
         4183  +|   3648: 6b 20 49 4e 54 45 47 45 52 2c 65 6e 64 5f 62 6c   k INTEGER,end_bl
         4184  +|   3664: 6f 63 6b 20 49 4e 54 45 47 45 52 2c 72 6f 6f 74   ock INTEGER,root
         4185  +|   3680: 20 42 4c 4f 42 2c 50 52 49 4d 41 52 59 20 4b 45    BLOB,PRIMARY KE
         4186  +|   3696: 59 28 6c 65 76 65 6c 2c 20 69 64 78 29 29 31 06   Y(level, idx))1.
         4187  +|   3712: 06 17 45 1f 01 00 69 6e 64 65 78 73 71 6c 69 74   ..E...indexsqlit
         4188  +|   3728: 65 5f 61 75 74 6f 69 6e 64 65 78 5f 74 31 5f 73   e_autoindex_t1_s
         4189  +|   3744: 65 67 64 69 72 5f 31 74 31 5f 73 65 67 64 69 72   egdir_1t1_segdir
         4190  +|   3760: 06 0f c7 00 08 00 00 00 00 66 04 07 17 23 23 01   .........f...##.
         4191  +|   3776: 81 13 74 61 62 6c 65 74 31 5f 73 65 67 6d 65 6e   ..tablet1_segmen
         4192  +|   3792: 64 73 74 31 5f 73 65 67 6d 65 6e 74 73 04 43 52   dst1_segments.CR
         4193  +|   3808: 45 41 54 45 20 54 41 42 4c 45 20 27 74 31 5f 73   EATE TABLE 't1_s
         4194  +|   3824: 65 67 6d 65 6e 74 73 27 28 62 6c 6f 63 6b 69 64   egments'(blockid
         4195  +|   3840: 20 49 4e 54 45 47 45 52 20 50 52 49 4d 41 52 59    INTEGER PRIMARY
         4196  +|   3856: 20 4b 45 59 2c 20 62 6c 6f 63 6b 20 42 4c 4f 42    KEY, block BLOB
         4197  +|   3872: 29 6a 03 07 17 21 21 01 81 1f 74 61 62 6c 65 74   )j...!!...tablet
         4198  +|   3888: 31 5f 63 6f 6e 74 65 6e 74 74 31 5f 63 6f 6e 74   1_contentt1_cont
         4199  +|   3904: 65 6e 74 03 43 52 45 41 54 45 20 54 41 42 4c 45   ent.CREATE TABLE
         4200  +|   3920: 20 27 74 31 5f 63 6f 6e 74 65 6e 74 27 28 64 6f    't1_content'(do
         4201  +|   3936: 63 69 64 20 49 4e 54 45 47 45 52 20 50 52 39 4d   cid INTEGER PR9M
         4202  +|   3952: 41 52 59 20 4b 45 59 2c 20 27 63 30 61 27 2c 20   ARY KEY, 'c0a', 
         4203  +|   3968: 27 63 31 62 27 2c 20 27 63 32 63 27 29 38 02 06   'c1b', 'c2c')8..
         4204  +|   3984: 17 11 11 08 5f 74 61 62 6c 65 74 31 74 31 43 52   ...._tablet1t1CR
         4205  +|   4000: 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42   EATE VIRTUAL TAB
         4206  +|   4016: 4c 45 20 74 31 20 55 53 49 4e 47 20 66 74 73 33   LE t1 USING fts3
         4207  +|   4032: 28 61 2c 62 2c 63 29 00 00 00 00 00 00 00 00 00   (a,b,c).........
         4208  +| page 3 offset 8192
         4209  +|      0: 0d 00 00 00 26 0b 48 0e 0f d8 0f af 0f 86 0f 74   ....&.H........t
         4210  +|     16: 0f 61 0f 4e 0f 2f 0f 0f 0e ef 0e d7 0e be 0e a5   .a.N./..........
         4211  +|     32: 0e 8d 0e 74 0e 5b 0e 40 0e 24 0e 08 0d ef 0d d5   ...t.[.@.$......
         4212  +|     48: 0d bb 0d a0 0e 94 03 28 0d 4f 0d 35 0d 1b 05 0b   .......(.O.5....
         4213  +|     64: 0c da 0c b9 0c 99 0c 78 0c 57 0c 3e 0c 24 0c 0a   .......x.W.>.$..
         4214  +|   2880: 00 00 00 00 00 00 00 00 81 3f 25 06 00 72 7f 00   .........?%..r..
         4215  +|   2896: 00 43 4f 4d 50 49 4c 45 52 3d 67 63 63 2d 35 2e   .COMPILER=gcc-5.
         4216  +|   2912: 34 2e 30 20 32 30 31 36 30 36 30 39 20 44 55 42   4.0 20160609 DUB
         4217  +|   2928: 55 47 20 45 4e 41 e4 7c 45 20 44 42 53 54 41 54   UG ENA.|E DBSTAT
         4218  +|   2944: e4 46 54 41 42 20 45 4e 41 42 4c 45 20 46 54 53   .FTAB ENABLE FTS
         4219  +|   2960: 34 20 45 4e 41 42 4c 45 20 46 54 53 35 20 45 4e   4 ENABLE FTS5 EN
         4220  +|   2976: 41 42 4c 45 20 47 45 4f 50 4f 4c 59 20 45 4e 41   ABLE GEOPOLY ENA
         4221  +|   2992: 42 4c 45 20 4a 53 4f 4e 31 20 45 4e 41 42 4c 45   BLE JSON1 ENABLE
         4222  +|   3008: 20 4d 45 4d 53 59 53 35 20 45 4e 41 42 4c 45 20    MEMSYS5 ENABLE 
         4223  +|   3024: 42 54 52 45 45 20 4d 41 58 20 4d 45 4d 4f 52 59   BTREE MAX MEMORY
         4224  +|   3040: 3d 35 30 30 30 30 30 30 30 20 4f 4c 49 54 20 4c   =50000000 OLIT L
         4225  +|   3056: 4f 41 43 20 45 58 54 45 4e 53 49 4f 4e 21 54 48   OAC EXTENSION!TH
         4226  +|   3072: 52 45 41 44 53 41 46 45 3d 30 18 24 05 00 25 0f   READSAFE=0.$..%.
         4227  +|   3088: 19 54 48 52 45 41 44 53 41 46 45 3d 30 58 42 49   .THREADSAFE=0XBI
         4228  +|   3104: 4e 41 52 59 18 23 05 00 25 0f 19 54 48 52 45 41   NARY.#..%..THREA
         4229  +|   3120: 44 53 41 4b 75 3d 30 58 4d 4f 43 41 53 45 17 22   DSAKu=0XMOCASE..
         4230  +|   3136: 05 00 25 0f 17 54 48 52 45 41 44 53 41 46 46 3d   ..%..THREADSAFF=
         4231  +|   3152: 30 58 52 54 52 49 4d 1f 21 05 00 33 0f 19 4f 4d   0XRTRIM.!..3..OM
         4232  +|   3168: 49 54 20 4c 4f 41 44 20 45 58 54 45 4e 52 49 4f   IT LOAD EXTENRIO
         4233  +|   3184: 4e 58 42 49 4e 41 52 59 1f 20 05 00 33 0f 19 4f   NXBINARY. ..3..O
         4234  +|   3200: 4d 49 54 20 4c 4f 41 44 20 45 58 54 45 4e 53 49   MIT LOAD EXTENSI
         4235  +|   3216: 4f 4e 58 4e 4f 43 41 53 45 1e 1f 05 00 33 0f 17   ONXNOCASE....3..
         4236  +|   3232: 4f 4d 49 54 20 4c 4f 41 44 20 45 58 54 45 4e 53   OMIT LOAD EXTENS
         4237  +|   3248: 49 4f 4e 58 52 54 52 49 4d 1f 1e 05 00 33 0f 19   IONXRTRIM....3..
         4238  +|   3264: 4d 41 58 20 4d 45 4d 4f 52 59 3d 35 30 30 30 30   MAX MEMORY=50000
         4239  +|   3280: 30 30 30 58 42 49 4e 41 52 59 1f 1d 05 00 33 0f   000XBINARY....3.
         4240  +|   3296: 19 4d 41 58 20 4d 45 4d 4f 52 59 3d 35 30 30 30   .MAX MEMORY=5000
         4241  +|   3312: 30 30 30 30 58 4e 4f 43 41 53 45 1e 1c 05 00 33   0000XNOCASE....3
         4242  +|   3328: 0f 17 4d 42 b8 20 4d 45 4d 4f 52 59 3d 35 30 30   ..MB. MEMORY=500
         4243  +|   3344: 30 30 30 30 30 58 52 54 52 49 4d 18 1b 05 00 25   00000XRTRIM....%
         4244  +|   3360: 0f 19 45 4e 41 42 4c 45 20 52 54 52 45 45 58 42   ..ENABLE RTREEXB
         4245  +|   3376: 49 4e 41 52 59 18 1a 05 0d a5 0f 19 45 4e 41 42   INARY.......ENAB
         4246  +|   3392: 4c 45 20 52 54 52 45 45 58 4e 4f 43 41 53 45 17   LE RTREEXNOCASE.
         4247  +|   3408: 19 1c 00 25 0f 17 45 4e 41 42 4c 45 20 52 54 52   ...%..ENABLE RTR
         4248  +|   3424: 45 45 58 52 54 52 49 4d 1a 18 05 00 29 0f 19 45   EEXRTRIM....)..E
         4249  +|   3440: 4e 41 42 4c 45 20 4d 45 4d 53 59 53 35 58 42 49   NABLE MEMSYS5XBI
         4250  +|   3456: 4e 41 52 59 1a 17 05 00 29 0f 19 45 4e 41 42 4c   NARY....)..ENABL
         4251  +|   3472: 45 20 4d 45 4d 53 59 53 35 58 4e 4f 43 41 53 45   E MEMSYS5XNOCASE
         4252  +|   3488: 19 16 05 00 29 0f 17 45 4e 41 42 4c 45 20 4d 45   ....)..ENABLE ME
         4253  +|   3504: 4d 53 59 53 35 58 52 54 52 49 4d 18 14 05 01 25   MSYS5XRTRIM....%
         4254  +|   3520: 0f 19 45 4e 12 42 4c 45 20 4a 53 4f 4e 31 58 42   ..EN.BLE JSON1XB
         4255  +|   3536: 49 4e 41 52 59 18 14 05 00 25 09 d9 45 4e 41 42   INARY....%..ENAB
         4256  +|   3552: 4c 45 20 4a 53 4f 3e 31 58 4e 4f 43 41 53 45 17   LE JSO>1XNOCASE.
         4257  +|   3568: 13 05 00 25 0f 17 45 4e 40 42 4c 45 20 4a 53 4f   ...%..EN@BLE JSO
         4258  +|   3584: 4e 31 58 52 54 52 49 4d 1a 12 05 82 29 0f 19 45   N1XRTRIM....)..E
         4259  +|   3600: 4e 41 42 4c 45 20 47 45 4f 50 4f 4c 59 58 42 49   NABLE GEOPOLYXBI
         4260  +|   3616: 4e 41 52 59 1a 11 05 c9 29 e8 19 46 4e 41 42 4c   NARY....)..FNABL
         4261  +|   3632: 48 c0 47 45 4f 50 4f 4c 59 58 4e 74 43 41 53 45   H.GEOPOLYXNtCASE
         4262  +|   3648: 19 10 05 00 29 0f 17 45 4e 41 42 4c 45 20 47 45   ....)..ENABLE GE
         4263  +|   3664: 4f 50 4f 4c 59 58 52 54 52 49 4d 17 0f 05 00 23   OPOLYXRTRIM....#
         4264  +|   3680: 0f 19 45 4e 41 42 4c 45 30 46 54 53 35 58 42 49   ..ENABLE0FTS5XBI
         4265  +|   3696: 4e 41 52 59 17 0e 05 00 23 0f 19 45 4e 41 42 4c   NARY....#..ENABL
         4266  +|   3712: 45 20 46 54 53 35 58 4e 4f 43 41 53 45 16 0e 05   E FTS5XNOCASE...
         4267  +|   3728: 00 23 0f 17 45 4e 41 42 4c 45 20 46 54 53 35 58   .#..ENABLE FTS5X
         4268  +|   3744: 52 54 52 49 4d 17 0c 05 00 23 0f 19 45 4e 41 42   RTRIM....#..ENAB
         4269  +|   3760: 4c 45 20 46 54 53 34 58 42 49 4e 41 52 59 17 0b   LE FTS4XBINARY..
         4270  +|   3776: 05 00 23 0f 19 45 4e 41 42 4c 45 20 46 54 53 34   ..#..ENABLE FTS4
         4271  +|   3792: 58 4e 4f 43 41 53 45 16 0a 05 00 23 0f 17 45 4e   XNOCASE....#..EN
         4272  +|   3808: 41 42 4c 45 20 46 54 53 34 58 52 54 52 49 4d 1e   ABLE FTS4XRTRIM.
         4273  +|   3824: 09 05 00 31 0f 19 45 4e 42 42 4c 45 20 44 42 53   ...1..ENBBLE DBS
         4274  +|   3840: 54 41 54 20 56 54 41 42 58 42 49 4e 41 52 59 1e   TAT VTABXBINARY.
         4275  +|   3856: 08 05 00 31 0f 19 45 4e 41 42 4c 45 20 44 42 53   ...1..ENABLE DBS
         4276  +|   3872: 54 41 54 20 56 54 41 42 58 4e 4f 43 41 53 45 1d   TAT VTABXNOCASE.
         4277  +|   3888: 07 05 00 31 0f 17 45 4e 41 42 4c 45 20 44 42 53   ...1..ENABLE DBS
         4278  +|   3904: 54 41 54 20 56 54 41 42 58 52 54 52 4a 4d 11 06   TAT VTABXRTRJM..
         4279  +|   3920: 05 f0 17 0f 19 44 45 42 55 47 58 42 49 4e 41 52   .....DEBUGXBINAR
         4280  +|   3936: 59 11 05 05 00 17 0e 19 44 45 42 55 47 58 4e 4f   Y.......DEBUGXNO
         4281  +|   3952: 43 41 53 45 10 04 05 00 17 0f 16 44 45 42 55 47   CASE.......DEBUG
         4282  +|   3968: 58 52 54 52 49 4d 27 03 05 00 43 0f 19 43 4f 4d   XRTRIM'...C..COM
         4283  +|   3984: 50 49 4c 45 52 3d 67 63 63 2d 35 2e 34 2e 30 20   PILER=gcc-5.4.0 
         4284  +|   4000: 32 30 31 36 30 36 30 39 58 42 49 4e 41 52 59 27   20160609XBINARY'
         4285  +|   4016: 02 05 00 43 0f 19 43 4f 4d 50 49 4c 45 52 3d 67   ...C..COMPILER=g
         4286  +|   4032: 63 63 2d 35 2e 34 2e 30 20 32 30 31 36 30 36 30   cc-5.4.0 2016060
         4287  +|   4048: 39 58 4e 4f 43 41 53 45 26 01 06 00 43 0f 17 43   9XNOCASE&...C..C
         4288  +|   4064: 4f 4d 50 49 4b 45 52 3d 67 63 63 2d 35 2e 34 2e   OMPIKER=gcc-5.4.
         4289  +|   4080: 30 20 32 30 31 36 30 36 40 39 58 29 54 52 49 4d   0 201606@9X)TRIM
         4290  +| page 4 offset 12288
         4291  +|      0: 0d 00 10 00 00 10 00 00 00 00 00 00 00 01 00 00   ................
         4292  +| page 5 offset 16384
         4293  +|      0: 0d 00 00 00 02 0b a0 00 0c ad 0b a0 00 00 00 00   ................
         4294  +|   2976: 82 0a 02 08 08 09 08 08 17 84 06 30 20 32 35 33   ...........0 253
         4295  +|   2992: 00 01 30 04 25 06 1b 00 00 08 32 30 31 36 30 36   ..0.%.....201606
         4296  +|   3008: 30 39 03 25 07 00 00 01 34 03 25 05 00 00 01 35   09.%....4.%....5
         4297  +|   3024: 03 25 04 00 01 07 30 30 30 30 30 30 30 03 25 1a   .%....0000000.%.
         4298  +|   3040: 00 00 08 63 6f 6d 70 69 6c 65 72 03 25 02 00 00   ...compiler.%...
         4299  +|   3056: 06 64 62 73 74 61 74 03 25 0a 00 01 04 65 62 75   .dbstat.%....ebu
         4300  +|   3072: 67 03 25 08 00 00 06 65 6e 61 62 6c 65 09 25 09   g.%....enable.%.
         4301  +|   3088: 05 04 04 04 04 04 00 01 08 78 74 65 6e 73 69 6f   .........xtensio
         4302  +|   3104: 6e 03 25 1d 00 00 04 66 74 73 34 03 25 0d 00 03   n.%....fts4.%...
         4303  +|   3120: 01 35 03 25 0f 00 00 03 67 63 63 03 25 03 00 01   .5.%....gcc.%...
         4304  +|   3136: 06 65 6f 70 6f 6c 79 03 25 11 00 00 05 6a 73 6f   .eopoly.%....jso
         4305  +|   3152: 6e 31 03 25 13 00 00 04 6c 6f 61 64 03 25 1c 00   n1.%....load.%..
         4306  +|   3168: 00 03 6d 61 78 03 25 18 00 01 05 65 6e 6f 72 79   ..max.%....enory
         4307  +|   3184: 03 25 19 00 03 04 ce 79 73 4d 03 25 15 00 00 04   .%.....ysM.%....
         4308  +|   3200: 6f 6d 69 74 03 25 1b 00 00 05 72 74 72 65 65 03   omit.%....rtree.
         4309  +|   3216: 25 17 00 00 0a 74 68 72 65 61 64 73 61 66 65 03   %....threadsafe.
         4310  +|   3232: 25 0e 00 00 04 76 74 61 62 03 25 0b 00 86 50 01   %....vtab.%...P.
         4311  +|   3248: 08 08 08 08 08 17 8d 12 30 20 38 33 35 00 01 30   ........0 835..0
         4312  +|   3264: 12 01 06 00 01 06 00 01 06 00 1f 03 00 01 03 09   ................
         4313  +|   3280: 51 03 00 00 08 32 30 31 36 30 36 30 39 09 01 07   Q....20160609...
         4314  +|   3296: 00 01 07 00 01 07 00 00 01 34 09 01 05 00 01 05   .........4......
         4315  +|   3312: 00 01 05 00 00 01 35 09 01 04 00 01 04 00 01 04   ......5.........
         4316  +|   3328: 00 01 07 30 30 30 30 30 30 30 09 1c 04 00 01 04   ...0000000......
         4317  +|   3344: 00 01 04 00 00 06 62 69 6e 61 72 79 3c 03 01 02   ......binary<...
         4318  +|   3360: 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02   ................
         4319  +|   3376: 00 03 01 02 02 00 02 f1 02 02 00 03 01 02 02 00   ................
         4320  +|   3392: 03 01 02 02 00 03 01 02 02 00 03 01 02 02 00 03   ................
         4321  +|   3408: 01 02 02 00 03 01 02 02 00 00 08 63 6f 6d 70 69   ...........compi
         4322  +|   3424: 6c 65 72 09 01 02 00 01 02 00 01 02 00 00 06 67   ler............g
         4323  +|   3440: d2 73 74 61 74 09 07 03 00 01 03 00 01 03 00 01   .stat...........
         4324  +|   3456: 04 65 62 75 67 09 04 02 00 01 02 00 01 02 00 00   .ebug...........
         4325  +|   3472: 06 65 6e 6f 82 6c 65 3f 07 02 00 01 02 00 01 02   .eno.le?........
         4326  +|   3488: b0 01 02 00 01 02 00 11 02 00 01 02 00 01 02 00   ................
         4327  +|   3504: 01 02 00 01 02 00 01 02 00 01 a6 00 01 02 00 01   ................
         4328  +|   3520: 02 05 51 02 00 01 02 00 01 02 00 01 02 00 01 02   ..Q.............
         4329  +|   3536: 00 01 02 00 01 02 00 01 08 78 74 65 6e 73 69 6f   .........xtensio
         4330  +|   3552: 6e 09 1f 04 00 01 04 00 00 04 00 00 04 66 74 73   n............fts
         4331  +|   3568: 34 09 0a 03 00 01 03 00 01 03 00 03 01 35 09 0d   4............5..
         4332  +|   3584: 03 00 01 03 00 01 03 00 00 03 67 63 63 09 01 03   ..........gcc...
         4333  +|   3600: 00 01 03 00 01 03 00 01 06 65 6f 70 73 6c 79 09   .........eopsly.
         4334  +|   3616: 10 03 00 01 03 00 01 03 00 00 05 6a 73 6f 6e 31   ...........json1
         4335  +|   3632: 09 13 03 00 01 03 00 01 03 00 00 04 6c 6f 61 64   ............load
         4336  +|   3648: 09 1f 03 00 01 03 00 01 03 00 00 03 6d 61 78 09   ............max.
         4337  +|   3664: 1c 02 00 01 02 00 01 02 00 01 05 65 6d 6f 72 79   ...........emory
         4338  +|   3680: 09 1c 03 00 01 03 00 01 03 00 03 04 73 79 73 35   ............sys5
         4339  +|   3696: 09 16 03 00 01 03 00 01 03 00 00 06 6e 6f 63 61   ............noca
         4340  +|   3712: 73 65 3c 02 01 02 02 00 03 01 12 02 00 03 01 02   se<.............
         4341  +|   3728: 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02   ................
         4342  +|   3744: 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02 00   ................
         4343  +|   3760: 03 01 02 02 00 03 01 02 02 00 03 01 02 02 00 00   ................
         4344  +|   3776: 0e 9f 6d 69 74 09 1f 02 00 01 02 00 01 02 00 00   ..mit...........
         4345  +|   3792: 05 72 74 72 65 65 09 19 03 00 01 03 00 01 03 00   .rtree..........
         4346  +|   3808: 03 02 69 6d 3c 01 01 02 02 00 03 01 02 02 00 03   ..im<...........
         4347  +|   3824: 01 02 02 00 03 01 02 02 00 03 01 02 02 00 03 01   ................
         4348  +|   3840: 02 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02   ................
         4349  +|   3856: 02 00 03 01 02 02 00 03 01 02 02 00 03 01 02 02   ................
         4350  +|   3872: 00 00 0a 74 68 72 65 61 64 73 61 66 65 09 22 02   ...threadsafe...
         4351  +|   3888: 00 01 02 00 01 02 00 00 04 76 74 61 62 09 07 04   .........vtab...
         4352  +|   3904: 00 01 04 00 01 04 00 00 01 78 b4 01 01 01 01 02   .........x......
         4353  +|   3920: 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00   ................
         4354  +|   3936: 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00 01   ................
         4355  +|   3952: 01 01 02 00 01 01 01 07 30 01 01 01 02 00 01 01   ........0.......
         4356  +|   3968: 01 02 00 11 01 01 02 00 01 01 01 02 00 11 01 01   ................
         4357  +|   3984: 02 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02   ................
         4358  +|   4000: 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00   ................
         4359  +|   4016: 01 01 01 01 ff 01 01 01 02 00 01 01 01 02 00 01   ................
         4360  +|   4032: 01 01 02 00 01 01 01 02 00 01 01 01 02 00 01 01   ................
         4361  +|   4048: 01 02 00 01 01 01 02 00 01 01 01 02 00 01 01 01   ................
         4362  +|   4064: 02 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02   ................
         4363  +|   4080: 00 01 01 01 02 00 01 01 01 02 00 01 01 01 02 00   ................
         4364  +| page 6 offset 20480
         4365  +|      0: 0a 00 00 00 02 0f f5 00 0f fb 0f f5 00 00 00 00   ................
         4366  +|   4080: 00 00 00 00 00 05 04 08 09 01 02 04 04 08 08 09   ................
         4367  +| page 7 offset 24576
         4368  +|      0: 0d 00 00 00 05 0f b8 00 0e f4 0f e9 10 d6 0f c7   ................
         4369  +|   4016: 00 00 00 00 00 00 00 00 0d 05 02 23 61 75 74 6f   ...........#auto
         4370  +|   4032: 6d 65 72 67 65 3d 35 0d 04 02 23 6d 65 72 67 65   merge=5...#merge
         4371  +|   4048: 3d 31 00 00 00 00 00 00 00 00 00 00 00 00 00 00   =1..............
         4372  +| end crash-dde9e76ed8ab2d.db
         4373  +}]} {}
         4374  +
         4375  +do_catchsql_test 25.1 {
         4376  +  WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x%1 FROM c WHERE x<599237)
         4377  +    INSERT INTO t1( a ) SELECT randomblob(3000) FROM t2 ;
         4378  +} {0 {}}
         4379  +
         4380  +do_catchsql_test 25.2 {
         4381  +  UPDATE t1 SET b=quote((true) ) WHERE t1 MATCH 'h*';
         4382  +} {0 {}}
         4383  +
         4384  +do_catchsql_test 25.3 {
         4385  +  WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x +x FROM c WHERE 72<x)
         4386  +    INSERT INTO t1(a) SELECT randomblob(2829) FROM c;
         4387  +} {0 {}}
         4388  +
         4389  +do_catchsql_test 25.4 {
         4390  +  WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x%1 FROM c WHERE 599237<x)
         4391  +    INSERT INTO t1(a) SELECT randomblob(3000) FROM t2 ;
         4392  +} {0 {}}
         4393  +
         4394  +do_catchsql_test 25.5 {
         4395  +  WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x%1 FROM c WHERE x<599237)
         4396  +    INSERT INTO t1( a ) SELECT randomblob(3000) FROM t2 ;
         4397  +} {0 {}}
         4398  +
         4399  +do_catchsql_test 25.6 {
         4400  +  INSERT INTO t1(t1) SELECT x FROM t2;
         4401  +  INSERT INTO t1(t1) SELECT x FROM t2;
         4402  +} {1 {database disk image is malformed}}
         4403  + 
  3918   4404   finish_test
  3919   4405   

Changes to test/fuzzdata8.db.

cannot compute difference between binary files

Changes to tool/showdb.c.

   831    831         a = fileRead((ovfl-1)*(sqlite3_int64)g.pagesize, 4);
   832    832         ovfl = decodeInt32(a);
   833    833         sqlite3_free(a);
   834    834       }
   835    835     }
   836    836   }
   837    837   
          838  +/*
          839  +** True if the memory is all zeros
          840  +*/
          841  +static int allZero(unsigned char *a, int n){
          842  +  while( n && (a++)[0]==0 ){ n--; }
          843  +  return n==0;
          844  +}
          845  +
   838    846   
   839    847   /*
   840         -** Describe the usages of a b-tree page
          848  +** Describe the usages of a b-tree page.
          849  +**
          850  +** If parent==0, then this is the root of a btree.  If parent<0 then
          851  +** this is an orphan page.
   841    852   */
   842    853   static void page_usage_btree(
   843    854     int pgno,             /* Page to describe */
   844    855     int parent,           /* Parent of this page.  0 for root pages */
   845    856     int idx,              /* Which child of the parent */
   846    857     const char *zName     /* Name of the table */
   847    858   ){
   848    859     unsigned char *a;
   849    860     const char *zType = "corrupt node";
   850    861     int nCell;
   851    862     int i;
   852    863     int hdr = pgno==1 ? 100 : 0;
          864  +  char zEntry[30];
   853    865   
   854    866     if( pgno<=0 || pgno>g.mxPage ) return;
   855    867     a = fileRead((pgno-1)*g.pagesize, g.pagesize);
   856    868     switch( a[hdr] ){
          869  +    case 0: {
          870  +      if( allZero(a, g.pagesize) ){
          871  +        zType = "zeroed page";
          872  +      }else if( parent<0 ){
          873  +        return;
          874  +      }else{
          875  +        zType = "corrupt node";
          876  +      }
          877  +      break;
          878  +    }
   857    879       case 2:  zType = "interior node of index";  break;
   858    880       case 5:  zType = "interior node of table";  break;
   859    881       case 10: zType = "leaf of index";           break;
   860    882       case 13: zType = "leaf of table";           break;
   861         -  }
   862         -  if( parent ){
   863         -    page_usage_msg(pgno, "%s [%s], child %d of page %d",
   864         -                   zType, zName, idx, parent);
   865         -  }else{
   866         -    page_usage_msg(pgno, "root %s [%s]", zType, zName);
          883  +    default: {
          884  +      if( parent<0 ) return;
          885  +      zType = "corrupt node";
          886  +    }
   867    887     }
   868    888     nCell = a[hdr+3]*256 + a[hdr+4];
          889  +  if( nCell==1 ){
          890  +    sqlite3_snprintf(sizeof(zEntry),zEntry,"1 row");
          891  +  }else{
          892  +    sqlite3_snprintf(sizeof(zEntry),zEntry,"%d rows", nCell);
          893  +  }
          894  +  if( parent>0 ){
          895  +    page_usage_msg(pgno, "%s [%s], child %d of page %d, %s",
          896  +                   zType, zName, idx, parent, zEntry);
          897  +  }else if( parent==0 ){
          898  +    page_usage_msg(pgno, "root %s [%s], %s", zType, zName, zEntry);
          899  +  }else{
          900  +    page_usage_msg(pgno, "orphaned %s, %s", zType, zEntry);
          901  +  }
   869    902     if( a[hdr]==2 || a[hdr]==5 ){
   870    903       int cellstart = hdr+12;
   871    904       unsigned int child;
   872    905       for(i=0; i<nCell; i++){
   873    906         int ofst;
   874    907   
   875    908         ofst = cellstart + i*2;
................................................................................
   984   1017       rc = sqlite3_finalize(pStmt);
   985   1018       if( rc==SQLITE_OK ) break;
   986   1019     }
   987   1020     sqlite3_close(db);
   988   1021   
   989   1022     /* Print the report and free memory used */
   990   1023     for(i=1; i<=g.mxPage; i++){
         1024  +    if( zPageUse[i]==0 ) page_usage_btree(i, -1, 0, 0);
   991   1025       printf("%5d: %s\n", i, zPageUse[i] ? zPageUse[i] : "???");
   992   1026       sqlite3_free(zPageUse[i]);
   993   1027     }
   994   1028     sqlite3_free(zPageUse);
   995   1029     zPageUse = 0;
   996   1030   }
   997   1031