/ Check-in [14ad62b9]
Login

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

Overview
Comment:Fix an uninitialized variable in printf when compiling with SQLITE_OMIT_FLOATING_POINT.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 14ad62b9a54dba5c5a2d4a994bcd4be6ab6e711f
User & Date: drh 2010-03-04 17:11:31
Context
2010-03-04
17:58
Fix for [9abd6aa831]. Do not overread a buffer used for an %q or %w conversion with a precision specifier. check-in: 5e472896 user: dan tags: trunk
17:11
Fix an uninitialized variable in printf when compiling with SQLITE_OMIT_FLOATING_POINT. check-in: 14ad62b9 user: drh tags: trunk
16:12
Suppress harmless compiler warnings. check-in: fc2c63ac user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/printf.c.

   456    456           }
   457    457           length = (int)(&buf[etBUFSIZE-1]-bufpt);
   458    458           break;
   459    459         case etFLOAT:
   460    460         case etEXP:
   461    461         case etGENERIC:
   462    462           realvalue = va_arg(ap,double);
   463         -#ifndef SQLITE_OMIT_FLOATING_POINT
          463  +#ifdef SQLITE_OMIT_FLOATING_POINT
          464  +        length = 0;
          465  +#else
   464    466           if( precision<0 ) precision = 6;         /* Set default precision */
   465    467           if( precision>etBUFSIZE/2-10 ) precision = etBUFSIZE/2-10;
   466    468           if( realvalue<0.0 ){
   467    469             realvalue = -realvalue;
   468    470             prefix = '-';
   469    471           }else{
   470    472             if( flag_plussign )          prefix = '+';
................................................................................
   602    604             for(i=width; i>=nPad; i--){
   603    605               bufpt[i] = bufpt[i-nPad];
   604    606             }
   605    607             i = prefix!=0;
   606    608             while( nPad-- ) bufpt[i++] = '0';
   607    609             length = width;
   608    610           }
   609         -#endif
          611  +#endif /* !defined(SQLITE_OMIT_FLOATING_POINT) */
   610    612           break;
   611    613         case etSIZE:
   612    614           *(va_arg(ap,int*)) = pAccum->nChar;
   613    615           length = width = 0;
   614    616           break;
   615    617         case etPERCENT:
   616    618           buf[0] = '%';