OLD | NEW |
1 Index: ext/fts3/fts3.c | 1 Index: ext/fts3/fts3.c |
2 =================================================================== | 2 =================================================================== |
3 --- ext/fts3/fts3.c (revision 48811) | 3 --- ext/fts3/fts3.c (revision 48811) |
4 +++ ext/fts3/fts3.c (working copy) | 4 +++ ext/fts3/fts3.c (working copy) |
5 @@ -271,6 +271,7 @@ | 5 @@ -271,6 +271,7 @@ |
6 ** deletions and duplications. This would basically be a forced merge | 6 ** deletions and duplications. This would basically be a forced merge |
7 ** into a single segment. | 7 ** into a single segment. |
8 */ | 8 */ |
9 +#define CHROMIUM_FTS3_CHANGES 1 | 9 +#define CHROMIUM_FTS3_CHANGES 1 |
10 | 10 |
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1103 @@ -4533,18 +4713,26 @@ | 1103 @@ -4533,18 +4713,26 @@ |
1104 }else{ | 1104 }else{ |
1105 int n, nPrefix, nSuffix; | 1105 int n, nPrefix, nSuffix; |
1106 | 1106 |
1107 - n = fts3GetVarint32(pReader->pData, &nPrefix); | 1107 - n = fts3GetVarint32(pReader->pData, &nPrefix); |
1108 - n += fts3GetVarint32(pReader->pData+n, &nSuffix); | 1108 - n += fts3GetVarint32(pReader->pData+n, &nSuffix); |
1109 + n = fts3GetVarint32Safe(pReader->pData, &nPrefix, pReader->nData); | 1109 + n = fts3GetVarint32Safe(pReader->pData, &nPrefix, pReader->nData); |
1110 + if( !n ) return SQLITE_CORRUPT_BKPT; | 1110 + if( !n ) return SQLITE_CORRUPT_BKPT; |
1111 + pReader->nData -= n; | 1111 + pReader->nData -= n; |
1112 + pReader->pData += n; | 1112 + pReader->pData += n; |
1113 + n += fts3GetVarint32Safe(pReader->pData, &nSuffix, pReader->nData); | 1113 + n = fts3GetVarint32Safe(pReader->pData, &nSuffix, pReader->nData); |
1114 + if( !n ) return SQLITE_CORRUPT_BKPT; | 1114 + if( !n ) return SQLITE_CORRUPT_BKPT; |
1115 + pReader->nData -= n; | 1115 + pReader->nData -= n; |
1116 + pReader->pData += n; | 1116 + pReader->pData += n; |
1117 + if( nSuffix<0 || nSuffix>pReader->nData ) return SQLITE_CORRUPT_BKPT; | 1117 + if( nSuffix<0 || nSuffix>pReader->nData ) return SQLITE_CORRUPT_BKPT; |
1118 + if( nPrefix<0 || nPrefix>pReader->term.nData ) return SQLITE_CORRUPT_BKPT; | 1118 + if( nPrefix<0 || nPrefix>pReader->term.nData ) return SQLITE_CORRUPT_BKPT; |
1119 | 1119 |
1120 /* Truncate the current term and append suffix data. */ | 1120 /* Truncate the current term and append suffix data. */ |
1121 pReader->term.nData = nPrefix; | 1121 pReader->term.nData = nPrefix; |
1122 - dataBufferAppend(&pReader->term, pReader->pData+n, nSuffix); | 1122 - dataBufferAppend(&pReader->term, pReader->pData+n, nSuffix); |
1123 + dataBufferAppend(&pReader->term, pReader->pData, nSuffix); | 1123 + dataBufferAppend(&pReader->term, pReader->pData, nSuffix); |
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1917 --- ext/fts3/fts3_tokenizer.c (revision 48811) | 1917 --- ext/fts3/fts3_tokenizer.c (revision 48811) |
1918 +++ ext/fts3/fts3_tokenizer.c (working copy) | 1918 +++ ext/fts3/fts3_tokenizer.c (working copy) |
1919 @@ -33,6 +33,7 @@ | 1919 @@ -33,6 +33,7 @@ |
1920 #include "fts3_hash.h" | 1920 #include "fts3_hash.h" |
1921 #include "fts3_tokenizer.h" | 1921 #include "fts3_tokenizer.h" |
1922 #include <assert.h> | 1922 #include <assert.h> |
1923 +#include <stddef.h> | 1923 +#include <stddef.h> |
1924 | 1924 |
1925 /* | 1925 /* |
1926 ** Implementation of the SQL scalar function for accessing the underlying | 1926 ** Implementation of the SQL scalar function for accessing the underlying |
OLD | NEW |