/ Check-in [ceeb4fba]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a problem with corrupt fts3 database detection introduced by [27199380].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | branch-3.22
Files: files | file ages | folders
SHA3-256: ceeb4fba84a651ddd432e87a968ec8d928030bf5b32c8790188d0fb5787c1b4b
User & Date: dan 2018-12-26 14:23:14
Context
2019-09-03
18:04
Disable the undocumented rtreenode() SQL function that is only used for testing, except when doing a build that is specifically intended for testing. check-in: 8452fd54 user: drh tags: branch-3.22
2018-12-26
14:23
Fix a problem with corrupt fts3 database detection introduced by [27199380]. check-in: ceeb4fba user: dan tags: branch-3.22
14:15
Fix a problem with corrupt fts3 database detection introduced by [95a9a39f]. check-in: c80bb15b user: dan tags: trunk
11:39
Avoid a left-shift of a negative value (undefined behaviour) when dealing with a corrupt database in fts3. Cherrypick of [b851d12474]. check-in: 2fa63a8b user: dan tags: branch-3.22
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/fts3/fts3_write.c.

  1404   1404     pReader->aDoclist = pNext;
  1405   1405     pReader->pOffsetList = 0;
  1406   1406   
  1407   1407     /* Check that the doclist does not appear to extend past the end of the
  1408   1408     ** b-tree node. And that the final byte of the doclist is 0x00. If either 
  1409   1409     ** of these statements is untrue, then the data structure is corrupt.
  1410   1410     */
  1411         -  if( pReader->nDoclist-(pReader->aDoclist-pReader->aNode) > pReader->nNode
         1411  +  if( pReader->nDoclist > pReader->nNode-(pReader->aDoclist-pReader->aNode)
  1412   1412      || (pReader->nPopulate==0 && pReader->aDoclist[pReader->nDoclist-1])
  1413   1413     ){
  1414   1414       return FTS_CORRUPT_VTAB;
  1415   1415     }
  1416   1416     return SQLITE_OK;
  1417   1417   }
  1418   1418