Hello Joe,

thank you for your attention, but your change does not fully address my issue.

This code still assumes that SQLITE_WIN32_CACHE_SIZE is measured in pages:

#ifndef SQLITE_WIN32_HEAP_INIT_SIZE
#  define SQLITE_WIN32_HEAP_INIT_SIZE   ((SQLITE_WIN32_CACHE_SIZE) * \
                                         (SQLITE_DEFAULT_PAGE_SIZE) + \
                                         (SQLITE_WIN32_HEAP_INIT_EXTRA))
#endif

But it is not:

#ifndef SQLITE_WIN32_CACHE_SIZE
#  if SQLITE_DEFAULT_CACHE_SIZE>=0
#    define SQLITE_WIN32_CACHE_SIZE     (SQLITE_DEFAULT_CACHE_SIZE)
#  else
#    define SQLITE_WIN32_CACHE_SIZE     (-(SQLITE_DEFAULT_CACHE_SIZE))
#  endif
#endif

If we go to the else branch, the SQLITE_WIN32_CACHE_SIZE will be KByte rather 
than pages. Your change may solve a potential overflow, but not the wrong 
calculation of SQLITE_WIN32_HEAP_INIT_SIZE if SQLITE_DEFAULT_PAGE_SIZE is 
specified as negative value (Kbyte).

Thanks,
Detlef.

-----Original Message-----
From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
Behalf Of Joe Mistachkin
Sent: Monday, February 20, 2017 8:25 PM
To: 'SQLite mailing list'
Subject: Re: [sqlite] Bug? Incorrect use of SQLITE_DEFAULT_CACHE_SIZE


Detlef Golze wrote:
>
> Changes carried forward from version 3.12.0 (2016-03-29):
> 

Ah, right.  I was reading the comments in the source code.

I've checked-in some changes that should prevent integer
overflows when very large values are used for the
SQLITE_DEFAULT_CACHE_SIZE and/or SQLITE_DEFAULT_PAGE_SIZE
defines.

--
Joe Mistachkin @ https://urn.to/r/mistachkin

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to