Fix an overzealous assert() in the UTF-16 to UTF-8 converter. (CVS 3338)

FossilOrigin-Name: 096bd8212fa06c7271fc24280133d1f0864ffb42
This commit is contained in:
drh 2006-07-26 14:57:30 +00:00
parent aa0fe8070d
commit 66f4a06259
4 changed files with 15 additions and 18 deletions

View File

@ -1,5 +1,5 @@
C Add\sa\stest\scase\sto\strigger\san\sassertion\sfault\swhen\srunning\nsqlite3_prepare16()\swith\sa\spredefined\sstring\ssize.\s(CVS\s3337)
D 2006-07-26T14:49:19
C Fix\san\soverzealous\sassert()\sin\sthe\sUTF-16\sto\sUTF-8\sconverter.\s(CVS\s3338)
D 2006-07-26T14:57:30
F Makefile.in 9c2a76055c305868cc5f5b73e29a252ff3632c0a
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -94,7 +94,7 @@ F src/test_tclvar.c 6611657977c69bccd32b4ff7ccfb221a403ca2f0
F src/tokenize.c 3454200eeec5b917efa513f0c5b093e1c81c72d3
F src/trigger.c 0fc40125820409a6274834a6e04ad804d96e2793
F src/update.c 951f95ef044cf6d28557c48dc35cb0711a0b9129
F src/utf.c ab81ac59084ff1c07d421eb1a0a84ec809603b44
F src/utf.c 4459801e9b00cfd69993bfca58545d3775682d6e
F src/util.c 5409031819ee4672c5f9c3ac7cf517e267a25845
F src/vacuum.c 5b37d0f436f8e1ffacd17934e44720b38d2247f9
F src/vdbe.c 106bc6216f1bf0176ae645813647b7c496ace962
@ -207,7 +207,7 @@ F test/malloc3.test fd4186bee73c2a2638f4e2a05a684c06836f725b
F test/malloc4.test 59cd02f71b363302a04c4e77b97c0a1572eaa210
F test/malloc5.test 7425272e263325fda7d32cb55706e52b5c09e7e0
F test/malloc6.test 025ae0b78542e0ddd000d23f79d93e9be9ba0f15
F test/malloc7.test 436b90dbe4a22a2f5309124f3b13ff33082e162d
F test/malloc7.test 1cf52834509eac7ebeb92105dacd4669f9ca9869
F test/manydb.test 8de36b8d33aab5ef295b11d9e95310aeded31af8
F test/memdb.test a67bda4ff90a38f2b19f6c7f95aa7289e051d893
F test/memleak.test df2b2b96e77f8ba159a332299535b1e5f18e49ac
@ -377,7 +377,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P e431131d47481f9fc64c498e8934b10a96b0a931
R 7e8761d6a912e35c00881f2d7e6d80bf
P 93878e6ebf703be022f83fd670c1aaaf7d4f1266
R 167e4d31c3ceea093995728310ddba84
U drh
Z 2f225d06d095b7c64a3eddb40e300558
Z b21afc244e8797d2644f042e2547a6b5

View File

@ -1 +1 @@
93878e6ebf703be022f83fd670c1aaaf7d4f1266
096bd8212fa06c7271fc24280133d1f0864ffb42

View File

@ -12,7 +12,7 @@
** This file contains routines used to translate between UTF-8,
** UTF-16, UTF-16BE, and UTF-16LE.
**
** $Id: utf.c,v 1.39 2006/04/16 12:05:03 drh Exp $
** $Id: utf.c,v 1.40 2006/07/26 14:57:30 drh Exp $
**
** Notes on UTF-8:
**
@ -462,8 +462,8 @@ char *sqlite3utf16to8(const void *z, int nByte){
memset(&m, 0, sizeof(m));
sqlite3VdbeMemSetStr(&m, z, nByte, SQLITE_UTF16NATIVE, SQLITE_STATIC);
sqlite3VdbeChangeEncoding(&m, SQLITE_UTF8);
assert( m.flags & MEM_Term );
assert( m.flags & MEM_Str );
assert( (m.flags & MEM_Term)!=0 || sqlite3MallocFailed() );
assert( (m.flags & MEM_Str)!=0 || sqlite3MallocFailed() );
return (m.flags & MEM_Dyn)!=0 ? m.z : sqliteStrDup(m.z);
}

View File

@ -1,4 +1,4 @@
# 2001 September 15
# 2006 July 26
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
@ -8,13 +8,10 @@
# May you share freely, never taking more than you give.
#
#***********************************************************************
# This file attempts to check the library in an out-of-memory situation.
# When compiled with -DSQLITE_DEBUG=1, the SQLite library accepts a special
# command (sqlite_malloc_fail N) which causes the N-th malloc to fail. This
# special feature is used to see what happens in the library if a malloc
# were to really fail due to an out-of-memory situation.
# This file contains additional out-of-memory checks (see malloc.tcl)
# added to expose a bug in out-of-memory handling for sqlite3_prepare16().
#
# $Id: malloc7.test,v 1.1 2006/07/26 14:49:19 drh Exp $
# $Id: malloc7.test,v 1.2 2006/07/26 14:57:30 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl