/ 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 Unified Diffs Ignore Whitespace Patch

Changes to src/main.c.

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }

/* IMPLEMENTATION-OF: R-35210-63508 The sqlite3_libversion_number() function
** returns an integer equal to SQLITE_VERSION_NUMBER.
*/
int sqlite3_libversion_number(void){ return SQLITE_VERSION_NUMBER; }

/* IMPLEMENTATION-OF: R-54823-41343 The sqlite3_threadsafe() function returns
** zero if and only if SQLite was compiled with mutexing code omitted due to
** the SQLITE_THREADSAFE compile-time option being set to 0.
*/
int sqlite3_threadsafe(void){ return SQLITE_THREADSAFE; }

#if !defined(SQLITE_OMIT_TRACE) && defined(SQLITE_ENABLE_IOTRACE)
/*







|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }

/* IMPLEMENTATION-OF: R-35210-63508 The sqlite3_libversion_number() function
** returns an integer equal to SQLITE_VERSION_NUMBER.
*/
int sqlite3_libversion_number(void){ return SQLITE_VERSION_NUMBER; }

/* IMPLEMENTATION-OF: R-20790-14025 The sqlite3_threadsafe() function returns
** zero if and only if SQLite was compiled with mutexing code omitted due to
** the SQLITE_THREADSAFE compile-time option being set to 0.
*/
int sqlite3_threadsafe(void){ return SQLITE_THREADSAFE; }

#if !defined(SQLITE_OMIT_TRACE) && defined(SQLITE_ENABLE_IOTRACE)
/*

Changes to src/pcache.c.

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

/*
** Try to obtain a page from the cache.
*/
int sqlite3PcacheFetch(







|







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

/*
** Try to obtain a page from the cache.
*/
int sqlite3PcacheFetch(