1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Fix a bug in pager.c that was overwriting freed memory. Comment changes

in util.c. (CVS 3002)

FossilOrigin-Name: 8c7e18c3f2f0487c6125f2d12720669e4d40e760
This commit is contained in:
drh
2006-01-23 15:39:58 +00:00
parent 8a7aea3bb3
commit 6245e0d19c
4 changed files with 16 additions and 19 deletions

View File

@@ -1,5 +1,5 @@
C Further\scoverage\simprovements\sfor\spager.c\sand\sanother\sIO\serror\sbug\sfix.\s(CVS\s3001) C Fix\sa\sbug\sin\spager.c\sthat\swas\soverwriting\sfreed\smemory.\s\sComment\schanges\nin\sutil.c.\s(CVS\s3002)
D 2006-01-23T15:25:48 D 2006-01-23T15:39:59
F Makefile.in ab3ffd8d469cef4477257169b82810030a6bb967 F Makefile.in ab3ffd8d469cef4477257169b82810030a6bb967
F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092 F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -59,7 +59,7 @@ F src/os_unix.c 38a55e51fb2c6f32c0ce86d274f5787f6c3668ed
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
F src/os_win.c 98e4e38db7d4a00647b2bb1c60d28b7ca5034c03 F src/os_win.c 98e4e38db7d4a00647b2bb1c60d28b7ca5034c03
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
F src/pager.c 86619d2739fe8757a0d5eff72a02a290b1c3fba0 F src/pager.c d94bad3ef24095d20f7ca355506daca53d4dec19
F src/pager.h e0acb095b3ad0bca48f2ab00c87346665643f64f F src/pager.h e0acb095b3ad0bca48f2ab00c87346665643f64f
F src/parse.y 4285cd2d0f31a8db4c4d54325f88e500452fa029 F src/parse.y 4285cd2d0f31a8db4c4d54325f88e500452fa029
F src/pragma.c 4496cc77dc35824e1c978c3d1413b8a5a4c777d3 F src/pragma.c 4496cc77dc35824e1c978c3d1413b8a5a4c777d3
@@ -85,7 +85,7 @@ F src/tokenize.c 9ae9a59238eb97fbc61baea280563b91100518fb
F src/trigger.c 4d3644cbd16959b568c95ae73493402be8021b08 F src/trigger.c 4d3644cbd16959b568c95ae73493402be8021b08
F src/update.c 14be4ba2f438919b4217085c02feff569e6cf1f2 F src/update.c 14be4ba2f438919b4217085c02feff569e6cf1f2
F src/utf.c 5ab8ca05d4e9ec81174b010f01ab12a232f0087d F src/utf.c 5ab8ca05d4e9ec81174b010f01ab12a232f0087d
F src/util.c 8c2e824e0bab3e5d1673213235e5dc0bdec441d4 F src/util.c 82ee598519b8193184bdeab06b51a4ffa05ad60b
F src/vacuum.c 3865673cc66acd0717ecd517f6b8fdb2a5e7924b F src/vacuum.c 3865673cc66acd0717ecd517f6b8fdb2a5e7924b
F src/vdbe.c 1b50083eb941eab37ffa220fdc47cf0965a7f176 F src/vdbe.c 1b50083eb941eab37ffa220fdc47cf0965a7f176
F src/vdbe.h 8729a4ee16ff9aeab2af9667df3cf300ff978e13 F src/vdbe.h 8729a4ee16ff9aeab2af9667df3cf300ff978e13
@@ -344,7 +344,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P 06d6540026568ca69410354ca8d85da78970c94b P a9ec5ee4724ab993e71ef8b387e2d92f3e74959c
R c456675e3ecb5484a33151ee57d158b9 R 49090966cc3b4e7c131019579384b4ba
U danielk1977 U drh
Z d1bfbd0b2d33163ba712dc25d4306067 Z 3e1c9095bb32c91ba1fc83cfc89e0035

View File

@@ -1 +1 @@
a9ec5ee4724ab993e71ef8b387e2d92f3e74959c 8c7e18c3f2f0487c6125f2d12720669e4d40e760

View File

@@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while ** file simultaneously, or one process from reading the database while
** another is writing. ** another is writing.
** **
** @(#) $Id: pager.c,v 1.252 2006/01/23 15:25:48 danielk1977 Exp $ ** @(#) $Id: pager.c,v 1.253 2006/01/23 15:39:59 drh Exp $
*/ */
#ifndef SQLITE_OMIT_DISKIO #ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -2694,11 +2694,8 @@ int sqlite3pager_get(Pager *pPager, Pgno pgno, void **ppPage){
int rc2 = sqlite3OsFileSize(pPager->fd, &fileSize); int rc2 = sqlite3OsFileSize(pPager->fd, &fileSize);
if( rc2!=SQLITE_OK || fileSize>=pgno*pPager->pageSize ){ if( rc2!=SQLITE_OK || fileSize>=pgno*pPager->pageSize ){
/* An IO error occured in one of the the sqlite3OsSeek() or /* An IO error occured in one of the the sqlite3OsSeek() or
** sqlite3OsRead() calls above. Unreference the page and then ** sqlite3OsRead() calls above. */
** set it's page number to 0 (0 means "not a page").
*/
sqlite3pager_unref(PGHDR_TO_DATA(pPg)); sqlite3pager_unref(PGHDR_TO_DATA(pPg));
pPg->pgno = 0;
return rc; return rc;
}else{ }else{
clear_simulated_io_error(); clear_simulated_io_error();

View File

@@ -14,7 +14,7 @@
** This file contains functions for allocating memory, comparing ** This file contains functions for allocating memory, comparing
** strings, and stuff like that. ** strings, and stuff like that.
** **
** $Id: util.c,v 1.181 2006/01/23 13:00:38 drh Exp $ ** $Id: util.c,v 1.182 2006/01/23 15:39:59 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "os.h" #include "os.h"
@@ -25,7 +25,7 @@
** MALLOC WRAPPER ARCHITECTURE ** MALLOC WRAPPER ARCHITECTURE
** **
** The sqlite code accesses dynamic memory allocation/deallocation by invoking ** The sqlite code accesses dynamic memory allocation/deallocation by invoking
** the following four APIs (which may be implemented as macros). ** the following six APIs (which may be implemented as macros).
** **
** sqlite3Malloc() ** sqlite3Malloc()
** sqlite3MallocRaw() ** sqlite3MallocRaw()
@@ -37,8 +37,8 @@
** The function sqlite3FreeX performs the same task as sqlite3Free and is ** The function sqlite3FreeX performs the same task as sqlite3Free and is
** guaranteed to be a real function. The same holds for sqlite3MallocX ** guaranteed to be a real function. The same holds for sqlite3MallocX
** **
** The above APIs are implemented in terms of the functions provided at the Os ** The above APIs are implemented in terms of the functions provided in the
** level (not in this file). The Os level interface is never accessed directly ** operating-system interface. The OS interface is never accessed directly
** by code outside of this file. ** by code outside of this file.
** **
** sqlite3OsMalloc() ** sqlite3OsMalloc()
@@ -55,7 +55,7 @@
** MALLOC TEST WRAPPER ARCHITECTURE ** MALLOC TEST WRAPPER ARCHITECTURE
** **
** The test wrapper provides extra test facilities to ensure the library ** The test wrapper provides extra test facilities to ensure the library
** does not leak memory and handles the failure of the underlying (Os level) ** does not leak memory and handles the failure of the underlying OS level
** allocation system correctly. It is only present if the library is ** allocation system correctly. It is only present if the library is
** compiled with the SQLITE_MEMDEBUG macro set. ** compiled with the SQLITE_MEMDEBUG macro set.
** **