summaryrefslogtreecommitdiffstats
path: root/third_party/sqlite/misalignment.patch
diff options
context:
space:
mode:
authorwangxianzhu@chromium.org <wangxianzhu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-18 00:49:33 +0000
committerwangxianzhu@chromium.org <wangxianzhu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-18 00:49:33 +0000
commitd567d600546768dbe7bff205ef8e84d9c660c9dd (patch)
tree207c3219498948ac011e429e492e0258b2c0177e /third_party/sqlite/misalignment.patch
parent8ad59e04c6cd26f6ce8f98be2c907501ecdb7d6e (diff)
downloadchromium_src-d567d600546768dbe7bff205ef8e84d9c660c9dd.zip
chromium_src-d567d600546768dbe7bff205ef8e84d9c660c9dd.tar.gz
chromium_src-d567d600546768dbe7bff205ef8e84d9c660c9dd.tar.bz2
Fix misaligned address in sqlite3.c
Fix the problem that an int* pointer is assigned with a value calculated from a UChar* pointer and an offset. If the offset is odd, the int* pointer will not be 4-byte aligned which causes SIGBUS on some CPUs. Please see #9 and #10 in crbug.com/151673 for details. BUG=151673 Review URL: https://chromiumcodereview.appspot.com/11183042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162593 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/sqlite/misalignment.patch')
-rw-r--r--third_party/sqlite/misalignment.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/third_party/sqlite/misalignment.patch b/third_party/sqlite/misalignment.patch
new file mode 100644
index 0000000..e421208
--- /dev/null
+++ b/third_party/sqlite/misalignment.patch
@@ -0,0 +1,48 @@
+diff --git ext/fts2/fts2_icu.c ext/fts2/fts2_icu.c
+index 6b9687e..a8b8359 100644
+--- ext/fts2/fts2_icu.c
++++ ext/fts2/fts2_icu.c
+@@ -118,15 +118,15 @@ static int icuOpen(
+ nChar = nInput+1;
+ pCsr = (IcuCursor *)sqlite3_malloc(
+ sizeof(IcuCursor) + /* IcuCursor */
+- nChar * sizeof(UChar) + /* IcuCursor.aChar[] */
+- (nChar+1) * sizeof(int) /* IcuCursor.aOffset[] */
++ (nChar+1) * sizeof(int) + /* IcuCursor.aOffset[] */
++ nChar * sizeof(UChar) /* IcuCursor.aChar[] */
+ );
+ if( !pCsr ){
+ return SQLITE_NOMEM;
+ }
+ memset(pCsr, 0, sizeof(IcuCursor));
+- pCsr->aChar = (UChar *)&pCsr[1];
+- pCsr->aOffset = (int *)&pCsr->aChar[nChar];
++ pCsr->aOffset = (int *)&pCsr[1];
++ pCsr->aChar = (UChar *)&pCsr->aOffset[nChar+1];
+
+ pCsr->aOffset[iOut] = iInput;
+ U8_NEXT(zInput, iInput, nInput, c);
+diff --git ext/fts3/fts3_icu.c ext/fts3/fts3_icu.c
+index a75b14a..e406168 100644
+--- ext/fts3/fts3_icu.c
++++ ext/fts3/fts3_icu.c
+@@ -118,15 +118,15 @@ static int icuOpen(
+ nChar = nInput+1;
+ pCsr = (IcuCursor *)sqlite3_malloc(
+ sizeof(IcuCursor) + /* IcuCursor */
+- nChar * sizeof(UChar) + /* IcuCursor.aChar[] */
+- (nChar+1) * sizeof(int) /* IcuCursor.aOffset[] */
++ (nChar+1) * sizeof(int) + /* IcuCursor.aOffset[] */
++ nChar * sizeof(UChar) /* IcuCursor.aChar[] */
+ );
+ if( !pCsr ){
+ return SQLITE_NOMEM;
+ }
+ memset(pCsr, 0, sizeof(IcuCursor));
+- pCsr->aChar = (UChar *)&pCsr[1];
+- pCsr->aOffset = (int *)&pCsr->aChar[nChar];
++ pCsr->aOffset = (int *)&pCsr[1];
++ pCsr->aChar = (UChar *)&pCsr->aOffset[nChar+1];
+
+ pCsr->aOffset[iOut] = iInput;
+ U8_NEXT(zInput, iInput, nInput, c);