SQLite

Check-in [65b1e3a4c3]
Login

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

Overview
Comment:Check-in [19064d7cea] broke the pTail return on sqlite3_prepare16() when the SQL contained surrogates. This check-in restores correct function. Part of ticket [3fe897352e].
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 65b1e3a4c31f6cb6fd3f600701658b0cdbee603f
User & Date: drh 2009-10-24 01:55:15.000
Context
2009-10-24
02:00
In shell, changed ".tables" command to not add '%' to specified pattern. This is consistent with other commands that take a LIKE pattern (.dump, .schema, .indices). Updated internal help to better describe LIKE pattern usage. Fixed a few more inconsistencies in error messages. Ticket [6da68f691b]. (check-in: 7201244e67 user: shane tags: trunk)
01:55
Check-in [19064d7cea] broke the pTail return on sqlite3_prepare16() when the SQL contained surrogates. This check-in restores correct function. Part of ticket [3fe897352e]. (check-in: 65b1e3a4c3 user: drh tags: trunk)
2009-10-23
18:15
Make sure that UTF16 to UTF8 conversions to not read past the end of the UTF16 input buffer if the last two bytes of the UTF16 happen to be the first half of a surrogate pair. Ticket [3fe897352e] (check-in: 19064d7cea user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/utf.c.
484
485
486
487
488
489
490
491
492






493
494
495
496
497
498
499
** pZ is a UTF-16 encoded unicode string at least nChar characters long.
** Return the number of bytes in the first nChar unicode characters
** in pZ.  nChar must be non-negative.
*/
int sqlite3Utf16ByteLen(const void *zIn, int nChar){
  int c;
  unsigned char const *z = zIn;
  unsigned char const *zTerm = &z[nChar];
  int n = 0;






  if( SQLITE_UTF16NATIVE==SQLITE_UTF16BE ){
    /* Using an "if (SQLITE_UTF16NATIVE==SQLITE_UTF16BE)" construct here
    ** and in other parts of this file means that at one branch will
    ** not be covered by coverage testing on any single host. But coverage
    ** will be complete if the tests are run on both a little-endian and 
    ** big-endian host. Because both the UTF16NATIVE and SQLITE_UTF16BE
    ** macros are constant at compile time the compiler can determine







|

>
>
>
>
>
>







484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
** pZ is a UTF-16 encoded unicode string at least nChar characters long.
** Return the number of bytes in the first nChar unicode characters
** in pZ.  nChar must be non-negative.
*/
int sqlite3Utf16ByteLen(const void *zIn, int nChar){
  int c;
  unsigned char const *z = zIn;
  unsigned char const *zTerm;
  int n = 0;

  /* Some of the characters might be surrogates.  Be careful not to terminate
  ** the string too early because of them.   In the worst case, all characters
  ** or surrogates so make the terminator 2*nChar from the beginning. */
  zTerm = &z[nChar*2];
  
  if( SQLITE_UTF16NATIVE==SQLITE_UTF16BE ){
    /* Using an "if (SQLITE_UTF16NATIVE==SQLITE_UTF16BE)" construct here
    ** and in other parts of this file means that at one branch will
    ** not be covered by coverage testing on any single host. But coverage
    ** will be complete if the tests are run on both a little-endian and 
    ** big-endian host. Because both the UTF16NATIVE and SQLITE_UTF16BE
    ** macros are constant at compile time the compiler can determine