/ Check-in [e0737f52]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Prevent negative values of SQLITE_DEFAULT_CACHE_SIZE from making SQLITE_WIN32_HEAP_INIT_SIZE negative.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e0737f5236ed3e85bd03203c880ee41b34619137
User & Date: mistachkin 2016-03-24 20:36:47
Context
2016-03-24
20:55
Make test cases in shell1.test robust against TCL deciding to quote strings using lots of backslashes. check-in: 817e93f4 user: drh tags: trunk
20:36
Prevent negative values of SQLITE_DEFAULT_CACHE_SIZE from making SQLITE_WIN32_HEAP_INIT_SIZE negative. check-in: e0737f52 user: mistachkin tags: trunk
15:32
Larger margins for one memsubsys1 range check when running with a non-zero reserved-bytes value. check-in: 6db1d1fb user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_win.c.

   340    340    *          data will almost certainly result in an immediate access violation.
   341    341    ******************************************************************************
   342    342    */
   343    343   #ifndef SQLITE_WIN32_HEAP_CREATE
   344    344   #  define SQLITE_WIN32_HEAP_CREATE    (TRUE)
   345    345   #endif
   346    346   
          347  +/*
          348  + * This is cache size used in the calculation of the initial size of the
          349  + * Win32-specific heap.  It cannot be negative.
          350  + */
          351  +#ifndef SQLITE_WIN32_CACHE_SIZE
          352  +#  if SQLITE_DEFAULT_CACHE_SIZE>=0
          353  +#    define SQLITE_WIN32_CACHE_SIZE (SQLITE_DEFAULT_CACHE_SIZE)
          354  +#  else
          355  +#    define SQLITE_WIN32_CACHE_SIZE (-(SQLITE_DEFAULT_CACHE_SIZE))
          356  +#  endif
          357  +#endif
          358  +
   347    359   /*
   348    360    * The initial size of the Win32-specific heap.  This value may be zero.
   349    361    */
   350    362   #ifndef SQLITE_WIN32_HEAP_INIT_SIZE
   351         -#  define SQLITE_WIN32_HEAP_INIT_SIZE ((SQLITE_DEFAULT_CACHE_SIZE) * \
          363  +#  define SQLITE_WIN32_HEAP_INIT_SIZE ((SQLITE_WIN32_CACHE_SIZE) * \
   352    364                                          (SQLITE_DEFAULT_PAGE_SIZE) + 4194304)
   353    365   #endif
   354    366   
   355    367   /*
   356    368    * The maximum size of the Win32-specific heap.  This value may be zero.
   357    369    */
   358    370   #ifndef SQLITE_WIN32_HEAP_MAX_SIZE