diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/os_os2.c | 3 | ||||
-rw-r--r-- | src/os_unix.c | 3 | ||||
-rw-r--r-- | src/os_win.c | 3 | ||||
-rw-r--r-- | src/sqlite.h.in | 8 |
4 files changed, 13 insertions, 4 deletions
diff --git a/src/os_os2.c b/src/os_os2.c index 26f905e5b..0a3b1434a 100644 --- a/src/os_os2.c +++ b/src/os_os2.c @@ -12,7 +12,7 @@ ** ** 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" @@ -124,6 +124,7 @@ static int os2Read( if( got == (ULONG)amt ) return SQLITE_OK; else { + /* Unread portions of the input buffer must be zero-filled */ memset(&((char*)pBuf)[got], 0, amt-got); return SQLITE_IOERR_SHORT_READ; } diff --git a/src/os_unix.c b/src/os_unix.c index 12509d1f6..503915c6b 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -12,7 +12,7 @@ ** ** 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" #if SQLITE_OS_UNIX /* This file is used on unix only */ @@ -897,6 +897,7 @@ static int unixRead( }else if( got<0 ){ return SQLITE_IOERR_READ; }else{ + /* Unread parts of the buffer must be zero-filled */ memset(&((char*)pBuf)[got], 0, amt-got); return SQLITE_IOERR_SHORT_READ; } diff --git a/src/os_win.c b/src/os_win.c index 502f8ab8c..f09b69861 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -12,7 +12,7 @@ ** ** 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" #if SQLITE_OS_WIN /* This file is used for windows only */ @@ -666,6 +666,7 @@ static int winRead( if( got==(DWORD)amt ){ return SQLITE_OK; }else{ + /* Unread parts of the buffer must be zero-filled */ memset(&((char*)pBuf)[got], 0, amt-got); return SQLITE_IOERR_SHORT_READ; } diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 34880884e..2af61fb4c 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -30,7 +30,7 @@ ** the version number) and changes its name to "sqlite3.h" as ** 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_ #define _SQLITE3_H_ @@ -682,6 +682,12 @@ struct sqlite3_file { ** way around. The SQLITE_IOCAP_SEQUENTIAL property means that ** information is written to disk in the same order as calls ** 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; struct sqlite3_io_methods { |