Overview
| Comment: | Enhance the RTree module to detect node truncation early and report an error. |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
66de6f4a9504ec2670b7273de8fb6955 |
| User & Date: | drh on 2017-07-01 15:21:17.151 |
| Other Links: | manifest | tags |
Context
|
2017-07-01
| ||
| 20:59 | Fix a memory management problem in lsm log recovery code. (check-in: dd55af30b4 user: dan tags: trunk) | |
| 15:21 | Enhance the RTree module to detect node truncation early and report an error. (check-in: 66de6f4a95 user: drh tags: trunk) | |
|
2017-06-30
| ||
| 20:11 | Improved documentation for sqlite3_value_type(). (check-in: 0db20efe20 user: drh tags: trunk) | |
Changes
Modified ext/rtree/rtree.c
from [9c55ff738a]
to [c5886d4ba7].
| ︙ | ︙ | |||
3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 |
zSql = sqlite3_mprintf(
"SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1",
pRtree->zDb, pRtree->zName
);
rc = getIntFromStmt(db, zSql, &pRtree->iNodeSize);
if( rc!=SQLITE_OK ){
*pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db));
}
}
sqlite3_free(zSql);
return rc;
}
| > > > > | 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 |
zSql = sqlite3_mprintf(
"SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1",
pRtree->zDb, pRtree->zName
);
rc = getIntFromStmt(db, zSql, &pRtree->iNodeSize);
if( rc!=SQLITE_OK ){
*pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db));
}else if( pRtree->iNodeSize<(512-64) ){
rc = SQLITE_CORRUPT;
*pzErr = sqlite3_mprintf("undersize RTree blobs in \"%q_node\"",
pRtree->zName);
}
}
sqlite3_free(zSql);
return rc;
}
|
| ︙ | ︙ |
Modified ext/rtree/rtreeA.test
from [ac8b503931]
to [e25d76c170].
| ︙ | ︙ | |||
211 212 213 214 215 216 217 218 219 220 |
do_execsql_test rtreeA-6.1.0 {
UPDATE t1_parent set parentnode = parentnode+1
} {}
do_corruption_tests rtreeA-6.1 {
1 "DELETE FROM t1 WHERE rowid = 5"
2 "UPDATE t1 SET x1=x1+1, x2=x2+1"
}
finish_test
| > > > > > > > > > > > > > | 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
do_execsql_test rtreeA-6.1.0 {
UPDATE t1_parent set parentnode = parentnode+1
} {}
do_corruption_tests rtreeA-6.1 {
1 "DELETE FROM t1 WHERE rowid = 5"
2 "UPDATE t1 SET x1=x1+1, x2=x2+1"
}
#-------------------------------------------------------------------------
# Truncated blobs in the _node table.
#
create_t1
populate_t1
sqlite3 db test.db
do_execsql_test rtreeA-7.100 {
UPDATE t1_node SET data=x'' WHERE rowid=1;
} {}
do_catchsql_test rtreeA-7.110 {
SELECT * FROM t1 WHERE x1>0 AND x1<100 AND x2>0 AND x2<100;
} {1 {undersize RTree blobs in "t1_node"}}
finish_test
|