OLD | NEW |
| (Empty) |
1 From 88d98dd2627e3dad4685443441fcd99a6ba61642 Mon Sep 17 00:00:00 2001 | |
2 From: Scott Hess <shess@chromium.org> | |
3 Date: Thu, 26 May 2011 18:44:46 +0000 | |
4 Subject: [PATCH 15/23] [fts3] Interior node corruption detection. | |
5 | |
6 In auditing as part of a previous import, I noticed this case which | |
7 seemed to allow for buffer overrun. The nPrefix check was commented out | |
8 because nBuffer wasn't always initialized, and I never circled back to | |
9 resolve that. | |
10 | |
11 It may be appropriate to just drop this patch, for now leaving it for | |
12 consistency. | |
13 | |
14 BUG=84057, 83946 | |
15 | |
16 Original review URLs: | |
17 http://codereview.chromium.org/7075014 | |
18 http://codereview.chromium.org/6990047 (3.7.6.3 SQLite import) | |
19 --- | |
20 third_party/sqlite/src/ext/fts3/fts3.c | 8 +++++++- | |
21 1 file changed, 7 insertions(+), 1 deletion(-) | |
22 | |
23 diff --git a/third_party/sqlite/src/ext/fts3/fts3.c b/third_party/sqlite/src/ext
/fts3/fts3.c | |
24 index da55f2a..d11572a 100644 | |
25 --- a/third_party/sqlite/src/ext/fts3/fts3.c | |
26 +++ b/third_party/sqlite/src/ext/fts3/fts3.c | |
27 @@ -1230,7 +1230,13 @@ static int fts3ScanInteriorNode( | |
28 isFirstTerm = 0; | |
29 zCsr += sqlite3Fts3GetVarint32(zCsr, &nSuffix); | |
30 | |
31 - if( nPrefix<0 || nSuffix<0 || &zCsr[nSuffix]>zEnd ){ | |
32 + /* NOTE(shess): Previous code checked for negative nPrefix and | |
33 + ** nSuffix and suffix overrunning zEnd. Additionally corrupt if | |
34 + ** the prefix is longer than the previous term, or if the suffix | |
35 + ** causes overflow. | |
36 + */ | |
37 + if( nPrefix<0 || nSuffix<0 /* || nPrefix>nBuffer */ | |
38 + || &zCsr[nSuffix]<zCsr || &zCsr[nSuffix]>zEnd ){ | |
39 rc = SQLITE_CORRUPT; | |
40 goto finish_scan; | |
41 } | |
42 -- | |
43 2.2.1 | |
44 | |
OLD | NEW |