1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Add documentation to make it clear that short reads from xRead in the VFS

must be zero-filled. (CVS 5867)

FossilOrigin-Name: fb311d6f4098a08f05b3fac9a2a7e2a53c38bb5f
This commit is contained in:
drh
2008-11-07 00:06:18 +00:00
parent 1735fa8892
commit 4c17c3fb11
6 changed files with 23 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
C Fix\sa\sbug\sin\sthe\sCAST\soperator\sassociated\swith\sthe\scolumn\scache.\s(CVS\s5866) C Add\sdocumentation\sto\smake\sit\sclear\sthat\sshort\sreads\sfrom\sxRead\sin\sthe\sVFS\nmust\sbe\szero-filled.\s(CVS\s5867)
D 2008-11-06T15:33:04 D 2008-11-07T00:06:18
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 48172b58e444a9725ec482e0c022a564749acab4 F Makefile.in 48172b58e444a9725ec482e0c022a564749acab4
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -135,9 +135,9 @@ F src/mutex_w32.c f0d21ff1f6981e5aedc56796adf3a347423ef736
F src/os.c 0b411644b87ad689d7250bbfd1834d99b81a3df4 F src/os.c 0b411644b87ad689d7250bbfd1834d99b81a3df4
F src/os.h ef8abeb9afc694b82dbd169a91c9b7e26db3c892 F src/os.h ef8abeb9afc694b82dbd169a91c9b7e26db3c892
F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60 F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60
F src/os_os2.c 24221ff5ab20cf3472e3ec7eec595f759de55298 F src/os_os2.c 63be0987dbeb42e9b08c831863d2a315953b86e1
F src/os_unix.c 5e3b3c9a54546249c1317cff5343e965192f7f2b F src/os_unix.c d17f694eda9d583676bcab87109efad42dd2abe1
F src/os_win.c a26292f39a73a446aa56b01871e73545da8ce3e4 F src/os_win.c e208cbbceac63c1dd881d0909de5a4679a2c6992
F src/pager.c e9103fc8ef7439db804425811a8d2b31fe3879b3 F src/pager.c e9103fc8ef7439db804425811a8d2b31fe3879b3
F src/pager.h 4a57b219c0765fe1870238064e3f46e4eb2cf5af F src/pager.h 4a57b219c0765fe1870238064e3f46e4eb2cf5af
F src/parse.y 2c4758b4c5ead6de8cf7112f5a7cce7561d313fe F src/parse.y 2c4758b4c5ead6de8cf7112f5a7cce7561d313fe
@@ -150,7 +150,7 @@ F src/random.c a87afbd598aa877e23ac676ee92fd8ee5c786a51
F src/resolve.c 266bb03d2b456fe68f5df2dd5687e7e88ff8088d F src/resolve.c 266bb03d2b456fe68f5df2dd5687e7e88ff8088d
F src/select.c 0d79c6c0b48b9d67a443853fd6add8c2967ba870 F src/select.c 0d79c6c0b48b9d67a443853fd6add8c2967ba870
F src/shell.c d83b578a8ccdd3e0e7fef4388a0887ce9f810967 F src/shell.c d83b578a8ccdd3e0e7fef4388a0887ce9f810967
F src/sqlite.h.in 2e1df3481504c85e3575e959685a8a748d1760c6 F src/sqlite.h.in e5c0dc85b1340f566d977263d4cca7ca32183c34
F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17 F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
F src/sqliteInt.h e32c2dbd6d2e53c2a4d137ce977313a38df38f8a F src/sqliteInt.h e32c2dbd6d2e53c2a4d137ce977313a38df38f8a
F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8 F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
@@ -654,7 +654,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P b568e325205acaa2f63bce2d6cc2808edc9f2e01 P 1b6a5140446da896f69fddc8d1ea076815bb45e3
R 7fca972b76b1da77615b78ffd2aa98cc R 08ee53a11b68016faeed82f91090e413
U drh U drh
Z 0371f6c304f61b7cf21fbe66f3d68ec0 Z 5e998c6356f65705edd280b38e19632c

View File

@@ -1 +1 @@
1b6a5140446da896f69fddc8d1ea076815bb45e3 fb311d6f4098a08f05b3fac9a2a7e2a53c38bb5f

View File

@@ -12,7 +12,7 @@
** **
** This file contains code that is specific to OS/2. ** This file contains code that is specific to OS/2.
** **
** $Id: os_os2.c,v 1.57 2008/10/13 21:46:47 pweilbacher Exp $ ** $Id: os_os2.c,v 1.58 2008/11/07 00:06:18 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -124,6 +124,7 @@ static int os2Read(
if( got == (ULONG)amt ) if( got == (ULONG)amt )
return SQLITE_OK; return SQLITE_OK;
else { else {
/* Unread portions of the input buffer must be zero-filled */
memset(&((char*)pBuf)[got], 0, amt-got); memset(&((char*)pBuf)[got], 0, amt-got);
return SQLITE_IOERR_SHORT_READ; return SQLITE_IOERR_SHORT_READ;
} }

View File

@@ -12,7 +12,7 @@
** **
** This file contains code that is specific to Unix systems. ** This file contains code that is specific to Unix systems.
** **
** $Id: os_unix.c,v 1.207 2008/10/16 13:27:41 danielk1977 Exp $ ** $Id: os_unix.c,v 1.208 2008/11/07 00:06:18 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#if SQLITE_OS_UNIX /* This file is used on unix only */ #if SQLITE_OS_UNIX /* This file is used on unix only */
@@ -897,6 +897,7 @@ static int unixRead(
}else if( got<0 ){ }else if( got<0 ){
return SQLITE_IOERR_READ; return SQLITE_IOERR_READ;
}else{ }else{
/* Unread parts of the buffer must be zero-filled */
memset(&((char*)pBuf)[got], 0, amt-got); memset(&((char*)pBuf)[got], 0, amt-got);
return SQLITE_IOERR_SHORT_READ; return SQLITE_IOERR_SHORT_READ;
} }

View File

@@ -12,7 +12,7 @@
** **
** This file contains code that is specific to windows. ** This file contains code that is specific to windows.
** **
** $Id: os_win.c,v 1.136 2008/10/22 16:55:47 shane Exp $ ** $Id: os_win.c,v 1.137 2008/11/07 00:06:18 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#if SQLITE_OS_WIN /* This file is used for windows only */ #if SQLITE_OS_WIN /* This file is used for windows only */
@@ -666,6 +666,7 @@ static int winRead(
if( got==(DWORD)amt ){ if( got==(DWORD)amt ){
return SQLITE_OK; return SQLITE_OK;
}else{ }else{
/* Unread parts of the buffer must be zero-filled */
memset(&((char*)pBuf)[got], 0, amt-got); memset(&((char*)pBuf)[got], 0, amt-got);
return SQLITE_IOERR_SHORT_READ; return SQLITE_IOERR_SHORT_READ;
} }

View File

@@ -30,7 +30,7 @@
** the version number) and changes its name to "sqlite3.h" as ** the version number) and changes its name to "sqlite3.h" as
** part of the build process. ** part of the build process.
** **
** @(#) $Id: sqlite.h.in,v 1.408 2008/11/04 14:48:23 drh Exp $ ** @(#) $Id: sqlite.h.in,v 1.409 2008/11/07 00:06:18 drh Exp $
*/ */
#ifndef _SQLITE3_H_ #ifndef _SQLITE3_H_
#define _SQLITE3_H_ #define _SQLITE3_H_
@@ -682,6 +682,12 @@ struct sqlite3_file {
** way around. The SQLITE_IOCAP_SEQUENTIAL property means that ** way around. The SQLITE_IOCAP_SEQUENTIAL property means that
** information is written to disk in the same order as calls ** information is written to disk in the same order as calls
** to xWrite(). ** to xWrite().
**
** If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill
** in the unread portions of the buffer with zeros. A VFS that
** fails to zero-fill short reads might seem to work. However,
** failure to zero-fill short reads will eventually lead to
** database corruption.
*/ */
typedef struct sqlite3_io_methods sqlite3_io_methods; typedef struct sqlite3_io_methods sqlite3_io_methods;
struct sqlite3_io_methods { struct sqlite3_io_methods {