OLD | NEW |
| (Empty) |
1 From 8c946ad53bf15c5972d9a68f3c77b385693e8637 Mon Sep 17 00:00:00 2001 | |
2 From: Xianzhu <wangxianzhu@chromium.org> | |
3 Date: Thu, 18 Oct 2012 00:49:33 +0000 | |
4 Subject: [PATCH 19/23] [fts2][backport] Fix misaligned address in icu | |
5 tokenizer. | |
6 | |
7 Fix the problem that an int* pointer is assigned with a value calculated | |
8 from a UChar* pointer and an offset. If the offset is odd, the int* pointer | |
9 will not be 4-byte aligned which causes SIGBUS on some CPUs. | |
10 | |
11 Please see #9 and #10 in crbug.com/151673 for details. | |
12 | |
13 BUG=151673 | |
14 | |
15 Original review URL: https://chromiumcodereview.appspot.com/11183042 | |
16 | |
17 This is upstreamed at: http://sqlite.org/src/info/aaa2d9b0db | |
18 --- | |
19 third_party/sqlite/src/ext/fts2/fts2_icu.c | 8 ++++---- | |
20 1 file changed, 4 insertions(+), 4 deletions(-) | |
21 | |
22 diff --git a/third_party/sqlite/src/ext/fts2/fts2_icu.c b/third_party/sqlite/src
/ext/fts2/fts2_icu.c | |
23 index 6b9687e..a8b8359 100644 | |
24 --- a/third_party/sqlite/src/ext/fts2/fts2_icu.c | |
25 +++ b/third_party/sqlite/src/ext/fts2/fts2_icu.c | |
26 @@ -118,15 +118,15 @@ static int icuOpen( | |
27 nChar = nInput+1; | |
28 pCsr = (IcuCursor *)sqlite3_malloc( | |
29 sizeof(IcuCursor) + /* IcuCursor */ | |
30 - nChar * sizeof(UChar) + /* IcuCursor.aChar[] */ | |
31 - (nChar+1) * sizeof(int) /* IcuCursor.aOffset[] */ | |
32 + (nChar+1) * sizeof(int) + /* IcuCursor.aOffset[] */ | |
33 + nChar * sizeof(UChar) /* IcuCursor.aChar[] */ | |
34 ); | |
35 if( !pCsr ){ | |
36 return SQLITE_NOMEM; | |
37 } | |
38 memset(pCsr, 0, sizeof(IcuCursor)); | |
39 - pCsr->aChar = (UChar *)&pCsr[1]; | |
40 - pCsr->aOffset = (int *)&pCsr->aChar[nChar]; | |
41 + pCsr->aOffset = (int *)&pCsr[1]; | |
42 + pCsr->aChar = (UChar *)&pCsr->aOffset[nChar+1]; | |
43 | |
44 pCsr->aOffset[iOut] = iInput; | |
45 U8_NEXT(zInput, iInput, nInput, c); | |
46 -- | |
47 2.2.1 | |
48 | |
OLD | NEW |