/ Check-in [a2304a34]
Login

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

Overview
Comment: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.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a2304a3474b0ca35eee0af64286ce2f7cb24d181323e128d5f04f7fe6e1c0980
User & Date: drh 2018-09-13 17:07:12
Context
2018-09-13
17:11
Update releasetest.tcl to run "make test" as part of the "Fast-One" configuration. check-in: d5ebfe1c user: dan tags: trunk
17:07
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. check-in: a2304a34 user: drh tags: trunk
13:17
Fix a requirement mark on a test script. No changes to code. check-in: 628d5c0a user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/printf.c.

   682    682             xtype = etSTRING;
   683    683           }else{
   684    684             bufpt = va_arg(ap,char*);
   685    685           }
   686    686           if( bufpt==0 ){
   687    687             bufpt = "";
   688    688           }else if( xtype==etDYNSTRING ){
   689         -          if( pAccum->nChar==0 && pAccum->mxAlloc && width==0 && precision<0 ){
          689  +          if( pAccum->nChar==0
          690  +           && pAccum->mxAlloc
          691  +           && width==0
          692  +           && precision<0
          693  +           && pAccum->accError==0
          694  +          ){
   690    695               /* Special optimization for sqlite3_mprintf("%z..."):
   691    696               ** Extend an existing memory allocation rather than creating
   692    697               ** a new one. */
   693    698               assert( (pAccum->printfFlags&SQLITE_PRINTF_MALLOCED)==0 );
   694    699               pAccum->zText = bufpt;
   695    700               pAccum->nAlloc = sqlite3DbMallocSize(pAccum->db, bufpt);
   696    701               pAccum->nChar = 0x7fffffff & (int)strlen(bufpt);