mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
Fix the OP_Concat operator such that when concatenating a BLOB with an
odd number of bytes on a database that is UTF16, the size of the resulting string is reduced to a multiple of two. FossilOrigin-Name: 5eb2c23635320b76f5e1aea4d94375b847fe4b38cdb4e287fba188753f4773b1
This commit is contained in:
@@ -1666,7 +1666,7 @@ case OP_Concat: { /* same as TK_CONCAT, in1, in2, out3 */
|
||||
if( nByte>db->aLimit[SQLITE_LIMIT_LENGTH] ){
|
||||
goto too_big;
|
||||
}
|
||||
if( sqlite3VdbeMemGrow(pOut, (int)nByte+3, pOut==pIn2) ){
|
||||
if( sqlite3VdbeMemGrow(pOut, (int)nByte+2, pOut==pIn2) ){
|
||||
goto no_mem;
|
||||
}
|
||||
MemSetTypeFlag(pOut, MEM_Str);
|
||||
@@ -1678,9 +1678,9 @@ case OP_Concat: { /* same as TK_CONCAT, in1, in2, out3 */
|
||||
memcpy(&pOut->z[pIn2->n], pIn1->z, pIn1->n);
|
||||
assert( (pIn1->flags & MEM_Dyn) == (flags1 & MEM_Dyn) );
|
||||
pIn1->flags = flags1;
|
||||
if( encoding>SQLITE_UTF8 ) nByte &= ~1;
|
||||
pOut->z[nByte]=0;
|
||||
pOut->z[nByte+1] = 0;
|
||||
pOut->z[nByte+2] = 0;
|
||||
pOut->flags |= MEM_Term;
|
||||
pOut->n = (int)nByte;
|
||||
pOut->enc = encoding;
|
||||
|
Reference in New Issue
Block a user