Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix a Pager ref-count leak in the sqlite_dbpage virtual table. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
c063bb04da77d6847e4e254b6bb939c8 |
User & Date: | drh 2017-10-27 18:24:11.866 |
Context
2017-10-28
| ||
12:20 | Add test cases from OSSFuzz to prevent a regression in co-routine processing. (check-in: 689743d8e3 user: drh tags: trunk) | |
2017-10-27
| ||
23:28 | I was a little concerned about this check-in. Though I could not generate a failure myself, I thought it was risky. I checked it in for further testing. Then, overnight, OSSFuzz found a failure case for me. So the change is now moved out into a deadend branch. Was: Use OP_SCopy rather than OP_Copy to transfer results from a co-routine to its consumer. This undoes an earlier fix for ticket [98825a79ce] by check-in [ec6a06246e] because that problem no longer occurs due to WHERE clause push-down. (Closed-Leaf check-in: 0926df095f user: drh tags: mistake) | |
18:24 | Fix a Pager ref-count leak in the sqlite_dbpage virtual table. (check-in: c063bb04da user: drh tags: trunk) | |
17:09 | Handle the Ctrl-C event for the shell on Win32. (check-in: c8aaf37117 user: mistachkin tags: trunk) | |
Changes
Changes to src/dbpage.c.
︙ | ︙ | |||
216 217 218 219 220 221 222 | static int dbpageFilter( sqlite3_vtab_cursor *pCursor, int idxNum, const char *idxStr, int argc, sqlite3_value **argv ){ DbpageCursor *pCsr = (DbpageCursor *)pCursor; DbpageTable *pTab = (DbpageTable *)pCursor->pVtab; | | | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | static int dbpageFilter( sqlite3_vtab_cursor *pCursor, int idxNum, const char *idxStr, int argc, sqlite3_value **argv ){ DbpageCursor *pCsr = (DbpageCursor *)pCursor; DbpageTable *pTab = (DbpageTable *)pCursor->pVtab; int rc; sqlite3 *db = pTab->db; Btree *pBt; /* Default setting is no rows of result */ pCsr->pgno = 1; pCsr->mxPgno = 0; |
︙ | ︙ | |||
250 251 252 253 254 255 256 257 258 259 260 261 262 263 | pCsr->mxPgno = 0; }else{ pCsr->mxPgno = pCsr->pgno; } }else{ assert( pCsr->pgno==1 ); } rc = sqlite3PagerGet(pCsr->pPager, 1, &pCsr->pPage1, 0); return rc; } static int dbpageColumn( sqlite3_vtab_cursor *pCursor, sqlite3_context *ctx, | > | 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | pCsr->mxPgno = 0; }else{ pCsr->mxPgno = pCsr->pgno; } }else{ assert( pCsr->pgno==1 ); } if( pCsr->pPage1 ) sqlite3PagerUnrefPageOne(pCsr->pPage1); rc = sqlite3PagerGet(pCsr->pPager, 1, &pCsr->pPage1, 0); return rc; } static int dbpageColumn( sqlite3_vtab_cursor *pCursor, sqlite3_context *ctx, |
︙ | ︙ |
Changes to test/dbpage.test.
︙ | ︙ | |||
52 53 54 55 56 57 58 59 60 61 62 63 64 65 | do_execsql_test 160 { ATTACH ':memory:' AS aux1; PRAGMA aux1.page_size=4096; CREATE TABLE aux1.t2(a,b,c); INSERT INTO t2 VALUES(11,12,13); SELECT pgno, quote(substr(data,1,5)) FROM sqlite_dbpage('aux1'); } {1 X'53514C6974' 2 X'0D00000001'} do_execsql_test 200 { CREATE TEMP TABLE saved_content(x); INSERT INTO saved_content(x) SELECT data FROM sqlite_dbpage WHERE pgno=4; UPDATE sqlite_dbpage SET data=zeroblob(4096) WHERE pgno=4; } {} do_catchsql_test 210 { | > > > > > > > > | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | do_execsql_test 160 { ATTACH ':memory:' AS aux1; PRAGMA aux1.page_size=4096; CREATE TABLE aux1.t2(a,b,c); INSERT INTO t2 VALUES(11,12,13); SELECT pgno, quote(substr(data,1,5)) FROM sqlite_dbpage('aux1'); } {1 X'53514C6974' 2 X'0D00000001'} do_execsql_test 170 { CREATE TABLE aux1.x3(x,y,z); INSERT INTO x3(x,y,z) VALUES(1,'main',1),(2,'aux1',1); SELECT pgno, schema, substr(data,1,6) FROM sqlite_dbpage, x3 WHERE sqlite_dbpage.schema=x3.y AND sqlite_dbpage.pgno=x3.z ORDER BY x3.x; } {1 main SQLite 1 aux1 SQLite} do_execsql_test 200 { CREATE TEMP TABLE saved_content(x); INSERT INTO saved_content(x) SELECT data FROM sqlite_dbpage WHERE pgno=4; UPDATE sqlite_dbpage SET data=zeroblob(4096) WHERE pgno=4; } {} do_catchsql_test 210 { |
︙ | ︙ |