/ Check-in [36e51526]
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 | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 36e515261825be60ffdc73d13340d77cf377e8e1
User & Date: dan 2015-04-28 14:07:02
Context
2015-04-28
14:49
Update the test/fuzzdata1.txt file with the latest cases discovered by AFL. check-in: f2063f53 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: 36e51526 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: fbb06727 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/alter.c.

   122    122       if( token==TK_REFERENCES ){
   123    123         char *zParent;
   124    124         do {
   125    125           z += n;
   126    126           n = sqlite3GetToken(z, &token);
   127    127         }while( token==TK_SPACE );
   128    128   
          129  +      if( token==TK_ILLEGAL ) break;
   129    130         zParent = sqlite3DbStrNDup(db, (const char *)z, n);
   130    131         if( zParent==0 ) break;
   131    132         sqlite3Dequote(zParent);
   132    133         if( 0==sqlite3StrICmp((const char *)zOld, zParent) ){
   133    134           char *zOut = sqlite3MPrintf(db, "%s%.*s\"%w\"", 
   134    135               (zOutput?zOutput:""), (int)(z-zInput), zInput, (const char *)zNew
   135    136           );

Changes to test/alter.test.

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