aboutsummaryrefslogtreecommitdiff
path: root/src/printf.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2018-09-13 17:07:12 +0000
committerdrh <drh@noemail.net>2018-09-13 17:07:12 +0000
commitaf524a6343e82d577dc34f443bfa090caca69c71 (patch)
tree65eb143f7620142ba616dc72d2482a3586425a17 /src/printf.c
parent396a103612298c5dd52b26f513631f8301a19fad (diff)
downloadsqlite-af524a6343e82d577dc34f443bfa090caca69c71.tar.gz
sqlite-af524a6343e82d577dc34f443bfa090caca69c71.zip
Make sure the %z optimization for printf() is not invoked if there has been
a prior error (SQLITE_NOMEM or SQLITE_TOOBIG) associated with the same printf() call. FossilOrigin-Name: a2304a3474b0ca35eee0af64286ce2f7cb24d181323e128d5f04f7fe6e1c0980
Diffstat (limited to 'src/printf.c')
-rw-r--r--src/printf.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/printf.c b/src/printf.c
index 71296ac90..7bce83f3e 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -686,7 +686,12 @@ void sqlite3_str_vappendf(
if( bufpt==0 ){
bufpt = "";
}else if( xtype==etDYNSTRING ){
- if( pAccum->nChar==0 && pAccum->mxAlloc && width==0 && precision<0 ){
+ if( pAccum->nChar==0
+ && pAccum->mxAlloc
+ && width==0
+ && precision<0
+ && pAccum->accError==0
+ ){
/* Special optimization for sqlite3_mprintf("%z..."):
** Extend an existing memory allocation rather than creating
** a new one. */