Fossil SCM
Update the built-in SQLite to version 3.8.9.
Commit
15e669399f29eac457e6222c78c3bed133ca5283
Parent
03921d444f2275e…
2 files changed
+24
-10
+1
-1
+24
-10
| --- src/sqlite3.c | ||
| +++ src/sqlite3.c | ||
| @@ -317,11 +317,11 @@ | ||
| 317 | 317 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 318 | 318 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 319 | 319 | */ |
| 320 | 320 | #define SQLITE_VERSION "3.8.9" |
| 321 | 321 | #define SQLITE_VERSION_NUMBER 3008009 |
| 322 | -#define SQLITE_SOURCE_ID "2015-04-06 11:04:51 3ad829e50faca538db3abb2afb898b5521550c5c" | |
| 322 | +#define SQLITE_SOURCE_ID "2015-04-08 12:16:33 8a8ffc862e96f57aa698f93de10dee28e69f6e09" | |
| 323 | 323 | |
| 324 | 324 | /* |
| 325 | 325 | ** CAPI3REF: Run-Time Library Version Numbers |
| 326 | 326 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 327 | 327 | ** |
| @@ -21524,19 +21524,23 @@ | ||
| 21524 | 21524 | }else{ |
| 21525 | 21525 | width = va_arg(ap,int); |
| 21526 | 21526 | } |
| 21527 | 21527 | if( width<0 ){ |
| 21528 | 21528 | flag_leftjustify = 1; |
| 21529 | - width = -width; | |
| 21529 | + width = width >= -2147483647 ? -width : 0; | |
| 21530 | 21530 | } |
| 21531 | 21531 | c = *++fmt; |
| 21532 | 21532 | }else{ |
| 21533 | + unsigned wx = 0; | |
| 21533 | 21534 | while( c>='0' && c<='9' ){ |
| 21534 | - width = width*10 + c - '0'; | |
| 21535 | + wx = wx*10 + c - '0'; | |
| 21535 | 21536 | c = *++fmt; |
| 21536 | 21537 | } |
| 21538 | + testcase( wx>0x7fffffff ); | |
| 21539 | + width = wx & 0x7fffffff; | |
| 21537 | 21540 | } |
| 21541 | + | |
| 21538 | 21542 | /* Get the precision */ |
| 21539 | 21543 | if( c=='.' ){ |
| 21540 | 21544 | precision = 0; |
| 21541 | 21545 | c = *++fmt; |
| 21542 | 21546 | if( c=='*' ){ |
| @@ -21543,17 +21547,22 @@ | ||
| 21543 | 21547 | if( bArgList ){ |
| 21544 | 21548 | precision = (int)getIntArg(pArgList); |
| 21545 | 21549 | }else{ |
| 21546 | 21550 | precision = va_arg(ap,int); |
| 21547 | 21551 | } |
| 21548 | - if( precision<0 ) precision = -precision; | |
| 21549 | 21552 | c = *++fmt; |
| 21553 | + if( precision<0 ){ | |
| 21554 | + precision = precision >= -2147483647 ? -precision : -1; | |
| 21555 | + } | |
| 21550 | 21556 | }else{ |
| 21557 | + unsigned px = 0; | |
| 21551 | 21558 | while( c>='0' && c<='9' ){ |
| 21552 | - precision = precision*10 + c - '0'; | |
| 21559 | + px = px*10 + c - '0'; | |
| 21553 | 21560 | c = *++fmt; |
| 21554 | 21561 | } |
| 21562 | + testcase( px>0x7fffffff ); | |
| 21563 | + precision = px & 0x7fffffff; | |
| 21555 | 21564 | } |
| 21556 | 21565 | }else{ |
| 21557 | 21566 | precision = -1; |
| 21558 | 21567 | } |
| 21559 | 21568 | /* Get the conversion type modifier */ |
| @@ -21713,11 +21722,12 @@ | ||
| 21713 | 21722 | if( flag_plussign ) prefix = '+'; |
| 21714 | 21723 | else if( flag_blanksign ) prefix = ' '; |
| 21715 | 21724 | else prefix = 0; |
| 21716 | 21725 | } |
| 21717 | 21726 | if( xtype==etGENERIC && precision>0 ) precision--; |
| 21718 | - for(idx=precision, rounder=0.5; idx>0; idx--, rounder*=0.1){} | |
| 21727 | + testcase( precision>0xfff ); | |
| 21728 | + for(idx=precision&0xfff, rounder=0.5; idx>0; idx--, rounder*=0.1){} | |
| 21719 | 21729 | if( xtype==etFLOAT ) realvalue += rounder; |
| 21720 | 21730 | /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */ |
| 21721 | 21731 | exp = 0; |
| 21722 | 21732 | if( sqlite3IsNaN((double)realvalue) ){ |
| 21723 | 21733 | bufpt = "NaN"; |
| @@ -21768,12 +21778,13 @@ | ||
| 21768 | 21778 | if( xtype==etEXP ){ |
| 21769 | 21779 | e2 = 0; |
| 21770 | 21780 | }else{ |
| 21771 | 21781 | e2 = exp; |
| 21772 | 21782 | } |
| 21773 | - if( MAX(e2,0)+precision+width > etBUFSIZE - 15 ){ | |
| 21774 | - bufpt = zExtra = sqlite3Malloc( MAX(e2,0)+precision+width+15 ); | |
| 21783 | + if( MAX(e2,0)+(i64)precision+(i64)width > etBUFSIZE - 15 ){ | |
| 21784 | + bufpt = zExtra | |
| 21785 | + = sqlite3Malloc( MAX(e2,0)+(i64)precision+(i64)width+15 ); | |
| 21775 | 21786 | if( bufpt==0 ){ |
| 21776 | 21787 | setStrAccumError(pAccum, STRACCUM_NOMEM); |
| 21777 | 21788 | return; |
| 21778 | 21789 | } |
| 21779 | 21790 | } |
| @@ -22001,11 +22012,11 @@ | ||
| 22001 | 22012 | ** Return the number of bytes of text that StrAccum is able to accept |
| 22002 | 22013 | ** after the attempted enlargement. The value returned might be zero. |
| 22003 | 22014 | */ |
| 22004 | 22015 | static int sqlite3StrAccumEnlarge(StrAccum *p, int N){ |
| 22005 | 22016 | char *zNew; |
| 22006 | - assert( p->nChar+N >= p->nAlloc ); /* Only called if really needed */ | |
| 22017 | + assert( p->nChar+(i64)N >= p->nAlloc ); /* Only called if really needed */ | |
| 22007 | 22018 | if( p->accError ){ |
| 22008 | 22019 | testcase(p->accError==STRACCUM_TOOBIG); |
| 22009 | 22020 | testcase(p->accError==STRACCUM_NOMEM); |
| 22010 | 22021 | return 0; |
| 22011 | 22022 | } |
| @@ -22050,11 +22061,14 @@ | ||
| 22050 | 22061 | |
| 22051 | 22062 | /* |
| 22052 | 22063 | ** Append N copies of character c to the given string buffer. |
| 22053 | 22064 | */ |
| 22054 | 22065 | SQLITE_PRIVATE void sqlite3AppendChar(StrAccum *p, int N, char c){ |
| 22055 | - if( p->nChar+N >= p->nAlloc && (N = sqlite3StrAccumEnlarge(p, N))<=0 ) return; | |
| 22066 | + testcase( p->nChar + (i64)N > 0x7fffffff ); | |
| 22067 | + if( p->nChar+(i64)N >= p->nAlloc && (N = sqlite3StrAccumEnlarge(p, N))<=0 ){ | |
| 22068 | + return; | |
| 22069 | + } | |
| 22056 | 22070 | while( (N--)>0 ) p->zText[p->nChar++] = c; |
| 22057 | 22071 | } |
| 22058 | 22072 | |
| 22059 | 22073 | /* |
| 22060 | 22074 | ** The StrAccum "p" is not large enough to accept N new bytes of z[]. |
| 22061 | 22075 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -317,11 +317,11 @@ | |
| 317 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 318 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 319 | */ |
| 320 | #define SQLITE_VERSION "3.8.9" |
| 321 | #define SQLITE_VERSION_NUMBER 3008009 |
| 322 | #define SQLITE_SOURCE_ID "2015-04-06 11:04:51 3ad829e50faca538db3abb2afb898b5521550c5c" |
| 323 | |
| 324 | /* |
| 325 | ** CAPI3REF: Run-Time Library Version Numbers |
| 326 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 327 | ** |
| @@ -21524,19 +21524,23 @@ | |
| 21524 | }else{ |
| 21525 | width = va_arg(ap,int); |
| 21526 | } |
| 21527 | if( width<0 ){ |
| 21528 | flag_leftjustify = 1; |
| 21529 | width = -width; |
| 21530 | } |
| 21531 | c = *++fmt; |
| 21532 | }else{ |
| 21533 | while( c>='0' && c<='9' ){ |
| 21534 | width = width*10 + c - '0'; |
| 21535 | c = *++fmt; |
| 21536 | } |
| 21537 | } |
| 21538 | /* Get the precision */ |
| 21539 | if( c=='.' ){ |
| 21540 | precision = 0; |
| 21541 | c = *++fmt; |
| 21542 | if( c=='*' ){ |
| @@ -21543,17 +21547,22 @@ | |
| 21543 | if( bArgList ){ |
| 21544 | precision = (int)getIntArg(pArgList); |
| 21545 | }else{ |
| 21546 | precision = va_arg(ap,int); |
| 21547 | } |
| 21548 | if( precision<0 ) precision = -precision; |
| 21549 | c = *++fmt; |
| 21550 | }else{ |
| 21551 | while( c>='0' && c<='9' ){ |
| 21552 | precision = precision*10 + c - '0'; |
| 21553 | c = *++fmt; |
| 21554 | } |
| 21555 | } |
| 21556 | }else{ |
| 21557 | precision = -1; |
| 21558 | } |
| 21559 | /* Get the conversion type modifier */ |
| @@ -21713,11 +21722,12 @@ | |
| 21713 | if( flag_plussign ) prefix = '+'; |
| 21714 | else if( flag_blanksign ) prefix = ' '; |
| 21715 | else prefix = 0; |
| 21716 | } |
| 21717 | if( xtype==etGENERIC && precision>0 ) precision--; |
| 21718 | for(idx=precision, rounder=0.5; idx>0; idx--, rounder*=0.1){} |
| 21719 | if( xtype==etFLOAT ) realvalue += rounder; |
| 21720 | /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */ |
| 21721 | exp = 0; |
| 21722 | if( sqlite3IsNaN((double)realvalue) ){ |
| 21723 | bufpt = "NaN"; |
| @@ -21768,12 +21778,13 @@ | |
| 21768 | if( xtype==etEXP ){ |
| 21769 | e2 = 0; |
| 21770 | }else{ |
| 21771 | e2 = exp; |
| 21772 | } |
| 21773 | if( MAX(e2,0)+precision+width > etBUFSIZE - 15 ){ |
| 21774 | bufpt = zExtra = sqlite3Malloc( MAX(e2,0)+precision+width+15 ); |
| 21775 | if( bufpt==0 ){ |
| 21776 | setStrAccumError(pAccum, STRACCUM_NOMEM); |
| 21777 | return; |
| 21778 | } |
| 21779 | } |
| @@ -22001,11 +22012,11 @@ | |
| 22001 | ** Return the number of bytes of text that StrAccum is able to accept |
| 22002 | ** after the attempted enlargement. The value returned might be zero. |
| 22003 | */ |
| 22004 | static int sqlite3StrAccumEnlarge(StrAccum *p, int N){ |
| 22005 | char *zNew; |
| 22006 | assert( p->nChar+N >= p->nAlloc ); /* Only called if really needed */ |
| 22007 | if( p->accError ){ |
| 22008 | testcase(p->accError==STRACCUM_TOOBIG); |
| 22009 | testcase(p->accError==STRACCUM_NOMEM); |
| 22010 | return 0; |
| 22011 | } |
| @@ -22050,11 +22061,14 @@ | |
| 22050 | |
| 22051 | /* |
| 22052 | ** Append N copies of character c to the given string buffer. |
| 22053 | */ |
| 22054 | SQLITE_PRIVATE void sqlite3AppendChar(StrAccum *p, int N, char c){ |
| 22055 | if( p->nChar+N >= p->nAlloc && (N = sqlite3StrAccumEnlarge(p, N))<=0 ) return; |
| 22056 | while( (N--)>0 ) p->zText[p->nChar++] = c; |
| 22057 | } |
| 22058 | |
| 22059 | /* |
| 22060 | ** The StrAccum "p" is not large enough to accept N new bytes of z[]. |
| 22061 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -317,11 +317,11 @@ | |
| 317 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 318 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 319 | */ |
| 320 | #define SQLITE_VERSION "3.8.9" |
| 321 | #define SQLITE_VERSION_NUMBER 3008009 |
| 322 | #define SQLITE_SOURCE_ID "2015-04-08 12:16:33 8a8ffc862e96f57aa698f93de10dee28e69f6e09" |
| 323 | |
| 324 | /* |
| 325 | ** CAPI3REF: Run-Time Library Version Numbers |
| 326 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 327 | ** |
| @@ -21524,19 +21524,23 @@ | |
| 21524 | }else{ |
| 21525 | width = va_arg(ap,int); |
| 21526 | } |
| 21527 | if( width<0 ){ |
| 21528 | flag_leftjustify = 1; |
| 21529 | width = width >= -2147483647 ? -width : 0; |
| 21530 | } |
| 21531 | c = *++fmt; |
| 21532 | }else{ |
| 21533 | unsigned wx = 0; |
| 21534 | while( c>='0' && c<='9' ){ |
| 21535 | wx = wx*10 + c - '0'; |
| 21536 | c = *++fmt; |
| 21537 | } |
| 21538 | testcase( wx>0x7fffffff ); |
| 21539 | width = wx & 0x7fffffff; |
| 21540 | } |
| 21541 | |
| 21542 | /* Get the precision */ |
| 21543 | if( c=='.' ){ |
| 21544 | precision = 0; |
| 21545 | c = *++fmt; |
| 21546 | if( c=='*' ){ |
| @@ -21543,17 +21547,22 @@ | |
| 21547 | if( bArgList ){ |
| 21548 | precision = (int)getIntArg(pArgList); |
| 21549 | }else{ |
| 21550 | precision = va_arg(ap,int); |
| 21551 | } |
| 21552 | c = *++fmt; |
| 21553 | if( precision<0 ){ |
| 21554 | precision = precision >= -2147483647 ? -precision : -1; |
| 21555 | } |
| 21556 | }else{ |
| 21557 | unsigned px = 0; |
| 21558 | while( c>='0' && c<='9' ){ |
| 21559 | px = px*10 + c - '0'; |
| 21560 | c = *++fmt; |
| 21561 | } |
| 21562 | testcase( px>0x7fffffff ); |
| 21563 | precision = px & 0x7fffffff; |
| 21564 | } |
| 21565 | }else{ |
| 21566 | precision = -1; |
| 21567 | } |
| 21568 | /* Get the conversion type modifier */ |
| @@ -21713,11 +21722,12 @@ | |
| 21722 | if( flag_plussign ) prefix = '+'; |
| 21723 | else if( flag_blanksign ) prefix = ' '; |
| 21724 | else prefix = 0; |
| 21725 | } |
| 21726 | if( xtype==etGENERIC && precision>0 ) precision--; |
| 21727 | testcase( precision>0xfff ); |
| 21728 | for(idx=precision&0xfff, rounder=0.5; idx>0; idx--, rounder*=0.1){} |
| 21729 | if( xtype==etFLOAT ) realvalue += rounder; |
| 21730 | /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */ |
| 21731 | exp = 0; |
| 21732 | if( sqlite3IsNaN((double)realvalue) ){ |
| 21733 | bufpt = "NaN"; |
| @@ -21768,12 +21778,13 @@ | |
| 21778 | if( xtype==etEXP ){ |
| 21779 | e2 = 0; |
| 21780 | }else{ |
| 21781 | e2 = exp; |
| 21782 | } |
| 21783 | if( MAX(e2,0)+(i64)precision+(i64)width > etBUFSIZE - 15 ){ |
| 21784 | bufpt = zExtra |
| 21785 | = sqlite3Malloc( MAX(e2,0)+(i64)precision+(i64)width+15 ); |
| 21786 | if( bufpt==0 ){ |
| 21787 | setStrAccumError(pAccum, STRACCUM_NOMEM); |
| 21788 | return; |
| 21789 | } |
| 21790 | } |
| @@ -22001,11 +22012,11 @@ | |
| 22012 | ** Return the number of bytes of text that StrAccum is able to accept |
| 22013 | ** after the attempted enlargement. The value returned might be zero. |
| 22014 | */ |
| 22015 | static int sqlite3StrAccumEnlarge(StrAccum *p, int N){ |
| 22016 | char *zNew; |
| 22017 | assert( p->nChar+(i64)N >= p->nAlloc ); /* Only called if really needed */ |
| 22018 | if( p->accError ){ |
| 22019 | testcase(p->accError==STRACCUM_TOOBIG); |
| 22020 | testcase(p->accError==STRACCUM_NOMEM); |
| 22021 | return 0; |
| 22022 | } |
| @@ -22050,11 +22061,14 @@ | |
| 22061 | |
| 22062 | /* |
| 22063 | ** Append N copies of character c to the given string buffer. |
| 22064 | */ |
| 22065 | SQLITE_PRIVATE void sqlite3AppendChar(StrAccum *p, int N, char c){ |
| 22066 | testcase( p->nChar + (i64)N > 0x7fffffff ); |
| 22067 | if( p->nChar+(i64)N >= p->nAlloc && (N = sqlite3StrAccumEnlarge(p, N))<=0 ){ |
| 22068 | return; |
| 22069 | } |
| 22070 | while( (N--)>0 ) p->zText[p->nChar++] = c; |
| 22071 | } |
| 22072 | |
| 22073 | /* |
| 22074 | ** The StrAccum "p" is not large enough to accept N new bytes of z[]. |
| 22075 |
+1
-1
| --- src/sqlite3.h | ||
| +++ src/sqlite3.h | ||
| @@ -111,11 +111,11 @@ | ||
| 111 | 111 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 112 | 112 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 113 | 113 | */ |
| 114 | 114 | #define SQLITE_VERSION "3.8.9" |
| 115 | 115 | #define SQLITE_VERSION_NUMBER 3008009 |
| 116 | -#define SQLITE_SOURCE_ID "2015-04-06 11:04:51 3ad829e50faca538db3abb2afb898b5521550c5c" | |
| 116 | +#define SQLITE_SOURCE_ID "2015-04-08 12:16:33 8a8ffc862e96f57aa698f93de10dee28e69f6e09" | |
| 117 | 117 | |
| 118 | 118 | /* |
| 119 | 119 | ** CAPI3REF: Run-Time Library Version Numbers |
| 120 | 120 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 121 | 121 | ** |
| 122 | 122 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -111,11 +111,11 @@ | |
| 111 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 112 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 113 | */ |
| 114 | #define SQLITE_VERSION "3.8.9" |
| 115 | #define SQLITE_VERSION_NUMBER 3008009 |
| 116 | #define SQLITE_SOURCE_ID "2015-04-06 11:04:51 3ad829e50faca538db3abb2afb898b5521550c5c" |
| 117 | |
| 118 | /* |
| 119 | ** CAPI3REF: Run-Time Library Version Numbers |
| 120 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 121 | ** |
| 122 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -111,11 +111,11 @@ | |
| 111 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 112 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 113 | */ |
| 114 | #define SQLITE_VERSION "3.8.9" |
| 115 | #define SQLITE_VERSION_NUMBER 3008009 |
| 116 | #define SQLITE_SOURCE_ID "2015-04-08 12:16:33 8a8ffc862e96f57aa698f93de10dee28e69f6e09" |
| 117 | |
| 118 | /* |
| 119 | ** CAPI3REF: Run-Time Library Version Numbers |
| 120 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 121 | ** |
| 122 |