Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

Unified Diff: third_party/sqlite/amalgamation/sqlite3.c

Issue 1671773003: [sqlite] Fix bug in how recover virtual table handles empty. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
Download patch
« no previous file with comments | « no previous file | third_party/sqlite/src/src/recover.c » ('j') | third_party/sqlite/src/src/recover.c » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/amalgamation/sqlite3.c
diff --git a/third_party/sqlite/amalgamation/sqlite3.c b/third_party/sqlite/amalgamation/sqlite3.c
index 22e11146c99db9946935e7e44a4bb5f3dd9a546e..54d0260bb25bf307c0803e7dcfbaf38c1fc3aa8d 100644
--- a/third_party/sqlite/amalgamation/sqlite3.c
+++ b/third_party/sqlite/amalgamation/sqlite3.c
@@ -137639,6 +137639,7 @@ struct RecoverLeafCursor {
*/
static int leafCursorLoadPage(RecoverLeafCursor *pCursor, DbPage *pPage){
const unsigned char *pPageHeader; /* Header of *pPage */
+ unsigned nCells; /* Number of cells in the page */
/* Release the current page. */
if( pCursor->pPage ){
@@ -137668,10 +137669,17 @@ static int leafCursorLoadPage(RecoverLeafCursor *pCursor, DbPage *pPage){
return SQLITE_OK;
}
+ /* Leaf contains no data, skip it. Empty tables, for instance. */
+ nCells = decodeUnsigned16(pPageHeader + kiPageCellCountOffset);;
+ if( nCells<1 ){
+ sqlite3PagerUnref(pPage);
+ return SQLITE_OK;
+ }
+
/* Take ownership of the page and start decoding. */
pCursor->pPage = pPage;
pCursor->iCell = 0;
- pCursor->nCells = decodeUnsigned16(pPageHeader + kiPageCellCountOffset);
+ pCursor->nCells = nCells;
return SQLITE_OK;
}
« no previous file with comments | « no previous file | third_party/sqlite/src/src/recover.c » ('j') | third_party/sqlite/src/src/recover.c » ('J')

Powered by Google App Engine
This is Rietveld 408576698