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
+21
View File
@@ -255,4 +255,25 @@ do_catchsql_test 5.5.2 {
ALTER TABLE c1 DROP COLUMN y
} {1 {error in trigger tr: no such column: new.z}}
# 2021-03-06 dbsqlfuzz crash-419aa525df93db6e463772c686ac6da27b46da9e
reset_db
do_catchsql_test 6.0 {
CREATE TABLE t1(a,b,c);
CREATE TABLE t2(x,y,z);
PRAGMA writable_schema=ON;
UPDATE sqlite_schema SET sql='CREATE INDEX t1b ON t1(b)' WHERE name='t2';
PRAGMA writable_schema=OFF;
ALTER TABLE t2 DROP COLUMN z;
} {1 {database disk image is malformed}}
reset_db
do_catchsql_test 6.1 {
CREATE TABLE t1(a,b,c);
CREATE TABLE t2(x,y,z);
PRAGMA writable_schema=ON;
UPDATE sqlite_schema SET sql='CREATE VIEW t2(x,y,z) AS SELECT b,a,c FROM t1'
WHERE name='t2';
PRAGMA writable_schema=OFF;
ALTER TABLE t2 DROP COLUMN z;
} {1 {database disk image is malformed}}
finish_test