Add assert()s to the implementation of xRead() in the built-in VFSes to

verify that the offset parameter is always non-negative.

FossilOrigin-Name: cf5c3642247fdd34d87f0368594cd7b8f081636a
This commit is contained in:
drh 2013-05-09 18:12:40 +00:00
parent b3129fa560
commit 6cf9d8d63a
4 changed files with 11 additions and 8 deletions

View File

@ -1,5 +1,5 @@
C Do\snot\smove\sWHERE\sclause\sterms\sinside\sOR\sexpressions\sthat\sare\scontained\nwithin\san\sON\sclause\sof\sa\sLEFT\sJOIN.\s\sFix\sfor\sticket\s[f2369304e47167e3e].
D 2013-05-09T14:20:11.944
C Add\sassert()s\sto\sthe\simplementation\sof\sxRead()\sin\sthe\sbuilt-in\sVFSes\sto\s\nverify\sthat\sthe\soffset\sparameter\sis\salways\snon-negative.
D 2013-05-09T18:12:40.898
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in ce81671efd6223d19d4c8c6b88ac2c4134427111
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -176,8 +176,8 @@ F src/notify.c 976dd0f6171d4588e89e874fcc765e92914b6d30
F src/os.c b4ad71336fd96f97776f75587cd9e8218288f5be
F src/os.h 4a46270a64e9193af4a0aaa3bc2c66dc07c29b3f
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
F src/os_unix.c 658b180a09a18214d94547f737dbded71667cdab
F src/os_win.c bf297963be89f9cddab53c3356e79daa3b8240d2
F src/os_unix.c 5e0b0ca7594f6707a3ed155528a3ba3318c95e15
F src/os_win.c 4e2bf0760409aef35e298ff725054e94d834e1a3
F src/pager.c 49e23f9898113ddfe90942bdf1c1ef57955d0921
F src/pager.h 5cb78b8e1adfd5451e600be7719f5a99d87ac3b1
F src/parse.y 9708365594eea519cdc8504dee425c0a41c79502
@ -1062,7 +1062,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
P 610425f19008b8b5d4bf027c8b14d97ec3115a54
R 4023dbf2ca58f8c405419172cf8781f4
P 1128575d0ab24f7023a0f6e6ce4828b9a09a7c6c
R 1cad29e868ca8cf8d5b7d354acd90934
U drh
Z cd99743e7f7615602ad15535e32e4fa6
Z 3b3f34da85296e9879a826be138cb510

View File

@ -1 +1 @@
1128575d0ab24f7023a0f6e6ce4828b9a09a7c6c
cf5c3642247fdd34d87f0368594cd7b8f081636a

View File

@ -3152,6 +3152,8 @@ static int unixRead(
unixFile *pFile = (unixFile *)id;
int got;
assert( id );
assert( offset>=0 );
assert( amt>0 );
/* If this is a database file (not a journal, master-journal or temp
** file), the bytes in the locking range should never be read or written. */

View File

@ -2157,6 +2157,7 @@ static int winRead(
assert( id!=0 );
assert( amt>0 );
assert( offset>=0 );
SimulateIOError(return SQLITE_IOERR_READ);
OSTRACE(("READ file=%p, buffer=%p, amount=%d, offset=%lld, lock=%d\n",
pFile->h, pBuf, amt, offset, pFile->locktype));