/ Check-in [17c30634]
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:Make sure large negative arguments to PRAGMA cache_size do not cause 32-bit signed integer overflow. Also correct a requirements mark.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 17c30634a71051158f8d37fd51b3c2a125ad8bd2
User & Date: drh 2012-01-02 15:45:12
Context
2012-01-02
16:38
Remove an incorrect assert() in btree.c. check-in: c1691d99 user: drh tags: trunk
15:45
Make sure large negative arguments to PRAGMA cache_size do not cause 32-bit signed integer overflow. Also correct a requirements mark. check-in: 17c30634 user: drh tags: trunk
14:50
Have SQLITE_FCNTL_SYNC_OMITTED use the normal method of returning an error code. check-in: fd3822f1 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/main.c.

    45     45   const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
    46     46   
    47     47   /* IMPLEMENTATION-OF: R-35210-63508 The sqlite3_libversion_number() function
    48     48   ** returns an integer equal to SQLITE_VERSION_NUMBER.
    49     49   */
    50     50   int sqlite3_libversion_number(void){ return SQLITE_VERSION_NUMBER; }
    51     51   
    52         -/* IMPLEMENTATION-OF: R-54823-41343 The sqlite3_threadsafe() function returns
           52  +/* IMPLEMENTATION-OF: R-20790-14025 The sqlite3_threadsafe() function returns
    53     53   ** zero if and only if SQLite was compiled with mutexing code omitted due to
    54     54   ** the SQLITE_THREADSAFE compile-time option being set to 0.
    55     55   */
    56     56   int sqlite3_threadsafe(void){ return SQLITE_THREADSAFE; }
    57     57   
    58     58   #if !defined(SQLITE_OMIT_TRACE) && defined(SQLITE_ENABLE_IOTRACE)
    59     59   /*

Changes to src/pcache.c.

   201    201   /*
   202    202   ** Compute the number of pages of cache requested.
   203    203   */
   204    204   static int numberOfCachePages(PCache *p){
   205    205     if( p->szCache>=0 ){
   206    206       return p->szCache;
   207    207     }else{
   208         -    return (-1024*p->szCache)/(p->szPage+p->szExtra);
          208  +    return (int)((-1024*(i64)p->szCache)/(p->szPage+p->szExtra));
   209    209     }
   210    210   }
   211    211   
   212    212   /*
   213    213   ** Try to obtain a page from the cache.
   214    214   */
   215    215   int sqlite3PcacheFetch(