From: danielk1977 Date: Sun, 15 Jan 2006 14:11:48 +0000 (+0000) Subject: Correctly set the length of the string in bytes when transforming an OP_String8 to... X-Git-Tag: version-3.6.10~3218 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=819d7f47355ffd8cd063cd83b730e06e456bda80;p=thirdparty%2Fsqlite.git Correctly set the length of the string in bytes when transforming an OP_String8 to OP_String in a utf-16 vdbe program. (CVS 2949) FossilOrigin-Name: 69f996e0fac1dc50b8c43d5fa132f79776843819 --- diff --git a/manifest b/manifest index b940c5b053..84a060d4af 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sbuffer-overrun\sthat\scould\soccur\safter\sa\smalloc()\sfailure.\s(CVS\s2948) -D 2006-01-15T13:13:57 +C Correctly\sset\sthe\slength\sof\sthe\sstring\sin\sbytes\swhen\stransforming\san\sOP_String8\sto\sOP_String\sin\sa\sutf-16\svdbe\sprogram.\s(CVS\s2949) +D 2006-01-15T14:11:49 F Makefile.in ab3ffd8d469cef4477257169b82810030a6bb967 F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -87,7 +87,7 @@ F src/update.c 261d75c702c2852d1a64274d7c414485e6f2d177 F src/utf.c 5ab8ca05d4e9ec81174b010f01ab12a232f0087d F src/util.c 0d0dc8279d4d0f43eb5d02313b77ab0ffa70f96d F src/vacuum.c 21a3c7f6f7be86bb1182fbc3df416ad702435b9e -F src/vdbe.c bf64026224ade859b32e6c01fcf292fbf069cb95 +F src/vdbe.c 4db1a9000e238e068de56108f5a9708cd4124d55 F src/vdbe.h 8729a4ee16ff9aeab2af9667df3cf300ff978e13 F src/vdbeInt.h 5451cf71f229e366ac543607c0a17f36e5737ea9 F src/vdbeapi.c afd3837cea0dec93dcb4724d073c84fa0da68e23 @@ -97,7 +97,7 @@ F src/vdbemem.c dd08a0eea4868ac4a2d91fdec32424308b1db772 F src/where.c 9fd58a8f5525d036a088c92bb14e2885c2243bc8 F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42 F test/all.test a23fcbbf1f53515bde840d78732a6d94c673b327 -F test/alter.test 2678f1ac6d6f7332623c5df249f58eeaa144a302 +F test/alter.test 1ac1263c8436bce05143565ed79c3c3c7c4bacaa F test/alter2.test cc0b8832e4e98605dbc26910efd4bb89abe59cb2 F test/alter3.test 6e144ea3dcc395afcc28e794bb532be83dc8fdcb F test/altermalloc.test 6e1f404ec021eb2ba6582e3c77b0a35cf206b7af @@ -341,7 +341,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 -P 1944d92b530d3bbcd31561063660de03d668af23 -R 2fd19f54530324dc3561ef0dc5fb5936 +P 662522218f967a8fb07427a9abd53334bb1400f7 +R 52e0f590fc81537fea07a2566db609a5 U danielk1977 -Z baf4b690ddb89093405c83bb5d1f469d +Z 32d89fdc432d236baf674d7c3f78a40f diff --git a/manifest.uuid b/manifest.uuid index a3b280305f..8f2541c7ab 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -662522218f967a8fb07427a9abd53334bb1400f7 \ No newline at end of file +69f996e0fac1dc50b8c43d5fa132f79776843819 \ No newline at end of file diff --git a/src/vdbe.c b/src/vdbe.c index 2859eb9f0a..381245589e 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -43,7 +43,7 @@ ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** -** $Id: vdbe.c,v 1.529 2006/01/13 17:12:01 danielk1977 Exp $ +** $Id: vdbe.c,v 1.530 2006/01/15 14:11:49 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -665,8 +665,7 @@ case OP_Real: { /* same as TK_FLOAT, */ /* Opcode: String8 * * P3 ** -** P3 points to a nul terminated UTF-8 string that is P1 character long -** (not counting the nul terminator). This opcode is transformed +** P3 points to a nul terminated UTF-8 string. This opcode is transformed ** into an OP_String before it is executed for the first time. */ case OP_String8: { /* same as TK_STRING */ @@ -687,7 +686,7 @@ case OP_String8: { /* same as TK_STRING */ } pOp->p3type = P3_DYNAMIC; pOp->p3 = pTos->z; - pOp->p1 *= 2; + pOp->p1 = pTos->n; break; } #endif @@ -696,7 +695,7 @@ case OP_String8: { /* same as TK_STRING */ /* Opcode: String P1 * P3 ** -** The string value P3 of length P1 is pushed onto the stack. +** The string value P3 of length P1 (bytes) is pushed onto the stack. */ case OP_String: { pTos++; diff --git a/test/alter.test b/test/alter.test index 0685398904..5dc4414b84 100644 --- a/test/alter.test +++ b/test/alter.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this script is testing the ALTER TABLE statement. # -# $Id: alter.test,v 1.14 2006/01/14 08:02:28 danielk1977 Exp $ +# $Id: alter.test,v 1.15 2006/01/15 14:11:49 danielk1977 Exp $ # set testdir [file dirname $argv0] @@ -552,11 +552,17 @@ do_test alter-5.3 { db2 close } {} +foreach tblname [execsql { + SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite%' +}] { + execsql "DROP TABLE \"$tblname\"" +} + set ::tbl_name "abc\uABCDdef" -do_test alter-5.1 { +do_test alter-6.1 { string length $::tbl_name } {7} -do_test alter-5.2 { +do_test alter-6.2 { execsql " CREATE TABLE ${tbl_name}(a, b, c); " @@ -565,8 +571,11 @@ do_test alter-5.2 { SELECT sql FROM sqlite_master WHERE oid = $::oid; } } "{CREATE TABLE ${::tbl_name}(a, b, c)}" +execsql " + SELECT * FROM ${::tbl_name} +" set ::tbl_name2 "abcXdef" -do_test alter-5.2 { +do_test alter-6.3 { execsql " ALTER TABLE $::tbl_name RENAME TO $::tbl_name2 " @@ -574,7 +583,7 @@ do_test alter-5.2 { SELECT sql FROM sqlite_master WHERE oid = $::oid; } } "{CREATE TABLE '${::tbl_name2}'(a, b, c)}" -do_test alter-5.3 { +do_test alter-6.4 { execsql " ALTER TABLE $::tbl_name2 RENAME TO $::tbl_name " @@ -583,7 +592,7 @@ do_test alter-5.3 { } } "{CREATE TABLE '${::tbl_name}'(a, b, c)}" set ::col_name ghi\1234\jkl -do_test alter-5.4 { +do_test alter-6.5 { execsql " ALTER TABLE $::tbl_name ADD COLUMN $::col_name VARCHAR " @@ -592,7 +601,7 @@ do_test alter-5.4 { } } "{CREATE TABLE '${::tbl_name}'(a, b, c, $::col_name VARCHAR)}" set ::col_name2 B\3421\A -do_test alter-5.5 { +do_test alter-6.6 { db close sqlite3 db test.db execsql " @@ -602,7 +611,7 @@ do_test alter-5.5 { SELECT sql FROM sqlite_master WHERE oid = $::oid; } } "{CREATE TABLE '${::tbl_name}'(a, b, c, $::col_name VARCHAR, $::col_name2)}" -do_test alter-5.6 { +do_test alter-6.7 { execsql " INSERT INTO ${::tbl_name} VALUES(1, 2, 3, 4, 5); SELECT $::col_name, $::col_name2 FROM $::tbl_name;