Fix a possible NULL pointer dereference when applying a DROP COLUMN to a

corrupt database schema.  dbsqlfuzz 419aa525df93db6e463772c686ac6da27b46da9e

FossilOrigin-Name: 349ccf58ae4bb770805066102fc8e9e478d4da1f7a6a728223bd74eabf7b7843
This commit is contained in:
drh
2021-03-06 13:02:12 +00:00
parent 70149ba47e
commit 747cc9425d
4 changed files with 30 additions and 9 deletions
+1 -1
View File
@@ -1807,7 +1807,7 @@ static void dropColumnFunc(
rc = renameParseSql(&sParse, zDb, db, zSql, iSchema==1);
if( rc!=SQLITE_OK ) goto drop_column_done;
pTab = sParse.pNewTable;
if( pTab->nCol==1 || iCol>=pTab->nCol ){
if( pTab==0 || pTab->nCol==1 || iCol>=pTab->nCol ){
/* This can happen if the sqlite_schema table is corrupt */
rc = SQLITE_CORRUPT_BKPT;
goto drop_column_done;