SQLite

Check-in [36e5152618]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix an assert() failure that could occur if the internal sqlite3_rename_parent() SQL scalar function was invoked directly.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 36e515261825be60ffdc73d13340d77cf377e8e1
User & Date: dan 2015-04-28 14:07:02.040
Context
2015-04-28
14:49
Update the test/fuzzdata1.txt file with the latest cases discovered by AFL. (check-in: f2063f5320 user: drh tags: trunk)
14:07
Fix an assert() failure that could occur if the internal sqlite3_rename_parent() SQL scalar function was invoked directly. (check-in: 36e5152618 user: dan tags: trunk)
14:00
Fix sqlite3VdbeMakeWritable() to always clear the MEM_Ephem flag. Change the OP_Move opcode to always deephemeralize moved content. (check-in: fbb0672718 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/alter.c.
122
123
124
125
126
127
128

129
130
131
132
133
134
135
    if( token==TK_REFERENCES ){
      char *zParent;
      do {
        z += n;
        n = sqlite3GetToken(z, &token);
      }while( token==TK_SPACE );


      zParent = sqlite3DbStrNDup(db, (const char *)z, n);
      if( zParent==0 ) break;
      sqlite3Dequote(zParent);
      if( 0==sqlite3StrICmp((const char *)zOld, zParent) ){
        char *zOut = sqlite3MPrintf(db, "%s%.*s\"%w\"", 
            (zOutput?zOutput:""), (int)(z-zInput), zInput, (const char *)zNew
        );







>







122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
    if( token==TK_REFERENCES ){
      char *zParent;
      do {
        z += n;
        n = sqlite3GetToken(z, &token);
      }while( token==TK_SPACE );

      if( token==TK_ILLEGAL ) break;
      zParent = sqlite3DbStrNDup(db, (const char *)z, n);
      if( zParent==0 ) break;
      sqlite3Dequote(zParent);
      if( 0==sqlite3StrICmp((const char *)zOld, zParent) ){
        char *zOut = sqlite3MPrintf(db, "%s%.*s\"%w\"", 
            (zOutput?zOutput:""), (int)(z-zInput), zInput, (const char *)zNew
        );
Changes to test/alter.test.
908
909
910
911
912
913
914









915
916
do_execsql_test alter-17.9 {
  SELECT sqlite_rename_parent('CREATE TABLE t1(a REFERENCES "xyzzy")',
         NULL, 'lmnop');
} {{}}
do_execsql_test alter-17.10 {
  SELECT sqlite_rename_parent(NULL,'abc','xyz');
} {{}}










finish_test







>
>
>
>
>
>
>
>
>


908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
do_execsql_test alter-17.9 {
  SELECT sqlite_rename_parent('CREATE TABLE t1(a REFERENCES "xyzzy")',
         NULL, 'lmnop');
} {{}}
do_execsql_test alter-17.10 {
  SELECT sqlite_rename_parent(NULL,'abc','xyz');
} {{}}
do_execsql_test alter-17.11 {
  SELECT sqlite_rename_parent('create references ''','abc','xyz');
} {{create references '}}
do_execsql_test alter-17.12 {
  SELECT sqlite_rename_parent('create references "abc"123" ','abc','xyz');
} {{create references "xyz"123" }}
do_execsql_test alter-17.13 {
  SELECT sqlite_rename_parent("references '''",'abc','xyz');
} {{references '''}}

finish_test