diff options
author | drh <drh@noemail.net> | 2004-06-22 22:04:46 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2004-06-22 22:04:46 +0000 |
commit | 1b743be858159ab936058c8cc093e8e374e3b134 (patch) | |
tree | 5082e92efd0f5b55ecd1a89fdbaeaebdc2da7e45 /src | |
parent | 7cf8c55add6b6ffe2575e72ef4813a21acfaf155 (diff) | |
download | sqlite-1b743be858159ab936058c8cc093e8e374e3b134.tar.gz sqlite-1b743be858159ab936058c8cc093e8e374e3b134.zip |
Be careful to initialize the Mem.xDel field to zero for static Mems. (CVS 1671)
FossilOrigin-Name: e17ea666b1eb1df12a1d4d78bda2e025e2aa30bd
Diffstat (limited to 'src')
-rw-r--r-- | src/printf.c | 2 | ||||
-rw-r--r-- | src/utf.c | 3 | ||||
-rw-r--r-- | src/vdbeInt.h | 2 | ||||
-rw-r--r-- | src/vdbeaux.c | 1 |
4 files changed, 5 insertions, 3 deletions
diff --git a/src/printf.c b/src/printf.c index cb03b3dc1..40af67e37 100644 --- a/src/printf.c +++ b/src/printf.c @@ -800,7 +800,7 @@ char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){ return z; } -#if defined(SQLITE_TEST) +#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG) /* ** A version of printf() that understands %lld. Used for debugging. ** The printf() built into some versions of windows does not understand %lld @@ -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.22 2004/06/18 17:10:17 drh Exp $ +** $Id: utf.c,v 1.23 2004/06/22 22:04:46 drh Exp $ ** ** Notes on UTF-8: ** @@ -321,6 +321,7 @@ int sqlite3VdbeMemTranslate(Mem *pMem, u8 desiredEnc){ WRITE_UTF8(z, 0); pMem->n = (z-zOut)-1; } + assert( pMem->n+1<=len ); } sqlite3VdbeMemRelease(pMem); diff --git a/src/vdbeInt.h b/src/vdbeInt.h index 688380dd0..946f9f716 100644 --- a/src/vdbeInt.h +++ b/src/vdbeInt.h @@ -121,8 +121,8 @@ struct Mem { u8 enc; /* TEXT_Utf8, TEXT_Utf16le, or TEXT_Utf16be */ double r; /* Real value */ char *z; /* String or BLOB value */ - char zShort[NBFS]; /* Space for short strings */ void (*xDel)(void *); /* If not null, call this function to delete Mem.z */ + char zShort[NBFS]; /* Space for short strings */ }; typedef struct Mem Mem; diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 249d32c8b..8efdac6f3 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -1602,6 +1602,7 @@ int sqlite3VdbeSerialGet( assert( serial_type>=12 ); pMem->z = (char *)buf; pMem->n = len; + pMem->xDel = 0; if( serial_type&0x01 ){ pMem->flags = MEM_Str | MEM_Ephem; }else{ |