Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: third_party/sqlite/memcmp.patch

Issue 15070002: Backport SQLite memcmp patch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 http://crbug.com/178677 refers to potential buffer overruns in ASAN
2 due to memcmp() being used instead of strcmp() in SQLite. Reported to
3 SQLite team, resulting in http://www.sqlite.org/src/info/d73435587b .
4 This was backported into Chromium's version of SQLite, then this file
5 was generated using:
6 git diff --relative=third_party/sqlite/src --src-prefix='' --dst-prefix='' > t hird_party/sqlite/memcmp.patch
7
8
9 diff --git src/analyze.c src/analyze.c
10 index 17c1de8..2444e74 100644
11 --- src/analyze.c
12 +++ src/analyze.c
13 @@ -142,7 +142,7 @@ static void analyzeOneTable(
14 /* Do not gather statistics on views or virtual tables */
15 return;
16 }
17 - if( memcmp(pTab->zName, "sqlite_", 7)==0 ){
18 + if( sqlite3_strnicmp(pTab->zName, "sqlite_", 7)==0 ){
19 /* Do not gather statistics on system tables */
20 return;
21 }
22 @@ -548,7 +548,7 @@ static int analysisLoader(void *pData, int argc, char **argv , char **NotUsed){
23 if( pIndex==0 ) break;
24 pIndex->aiRowEst[i] = v;
25 if( *z==' ' ) z++;
26 - if( memcmp(z, "unordered", 10)==0 ){
27 + if( strcmp(z, "unordered")==0 ){
28 pIndex->bUnordered = 1;
29 break;
30 }
31 diff --git src/build.c src/build.c
32 index 323a616..4f4f8ed 100644
33 --- src/build.c
34 +++ src/build.c
35 @@ -2480,7 +2480,7 @@ Index *sqlite3CreateIndex(
36 assert( pTab!=0 );
37 assert( pParse->nErr==0 );
38 if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0
39 - && memcmp(&pTab->zName[7],"altertab_",9)!=0 ){
40 + && sqlite3StrNICmp(&pTab->zName[7],"altertab_",9)!=0 ){
41 sqlite3ErrorMsg(pParse, "table %s may not be indexed", pTab->zName);
42 goto exit_create_index;
43 }
44 diff --git src/expr.c src/expr.c
45 index 2699ae1..a3ec67a 100644
46 --- src/expr.c
47 +++ src/expr.c
48 @@ -583,7 +583,7 @@ void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr){
49 for(i=0; i<pParse->nVarExpr; i++){
50 Expr *pE = pParse->apVarExpr[i];
51 assert( pE!=0 );
52 - if( memcmp(pE->u.zToken, z, n)==0 && pE->u.zToken[n]==0 ){
53 + if( strcmp(pE->u.zToken, z)==0 ){
54 pExpr->iColumn = pE->iColumn;
55 break;
56 }
57 diff --git src/os_unix.c src/os_unix.c
58 index 804c588..77ffd8a 100644
59 --- src/os_unix.c
60 +++ src/os_unix.c
61 @@ -4506,7 +4506,7 @@ int fillInUnixFile(
62 OSTRACE(("OPEN %-3d %s\n", h, zFilename));
63 pNew->h = h;
64 pNew->zPath = zFilename;
65 - if( memcmp(pVfs->zName,"unix-excl",10)==0 ){
66 + if( strcmp(pVfs->zName,"unix-excl")==0 ){
67 pNew->ctrlFlags = UNIXFILE_EXCL;
68 }else{
69 pNew->ctrlFlags = 0;
70 diff --git src/vdbeapi.c src/vdbeapi.c
71 index 90baacc..80ceb9f 100644
72 --- src/vdbeapi.c
73 +++ src/vdbeapi.c
74 @@ -1222,7 +1222,7 @@ int sqlite3VdbeParameterIndex(Vdbe *p, const char *zName, int nName){
75 if( zName ){
76 for(i=0; i<p->nVar; i++){
77 const char *z = p->azVar[i];
78 - if( z && memcmp(z,zName,nName)==0 && z[nName]==0 ){
79 + if( z && strncmp(z,zName,nName)==0 && z[nName]==0 ){
80 return i+1;
81 }
82 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698