Fossil SCM

Import the SQLite fix for integer to floating-point overflow from upstream. Fossil does not really need this. The import is for testing SQLite.

drh 2012-12-11 01:05 trunk
Commit d79ddface96751d8db09e75ee7b50e5c68655edb
2 files changed +6 -4 +1 -1
+6 -4
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -673,11 +673,11 @@
673673
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
674674
** [sqlite_version()] and [sqlite_source_id()].
675675
*/
676676
#define SQLITE_VERSION "3.7.15"
677677
#define SQLITE_VERSION_NUMBER 3007015
678
-#define SQLITE_SOURCE_ID "2012-12-08 22:14:29 92c9ab56b1c67b9468bec57ab1d2c483a69a2810"
678
+#define SQLITE_SOURCE_ID "2012-12-10 22:19:14 bd7aeeb691fee69dd6a562138a7aba8e8e192272"
679679
680680
/*
681681
** CAPI3REF: Run-Time Library Version Numbers
682682
** KEYWORDS: sqlite3_version, sqlite3_sourceid
683683
**
@@ -64089,10 +64089,11 @@
6408964089
} af;
6409064090
struct OP_Concat_stack_vars {
6409164091
i64 nByte;
6409264092
} ag;
6409364093
struct OP_Remainder_stack_vars {
64094
+ char bIntint; /* Started out as two integer operands */
6409464095
int flags; /* Combined MEM_* flags from both inputs */
6409564096
i64 iA; /* Integer value of left operand */
6409664097
i64 iB; /* Integer value of right operand */
6409764098
double rA; /* Real value of left operand */
6409864099
double rB; /* Real value of right operand */
@@ -65194,10 +65195,11 @@
6519465195
case OP_Subtract: /* same as TK_MINUS, in1, in2, out3 */
6519565196
case OP_Multiply: /* same as TK_STAR, in1, in2, out3 */
6519665197
case OP_Divide: /* same as TK_SLASH, in1, in2, out3 */
6519765198
case OP_Remainder: { /* same as TK_REM, in1, in2, out3 */
6519865199
#if 0 /* local variables moved into u.ah */
65200
+ char bIntint; /* Started out as two integer operands */
6519965201
int flags; /* Combined MEM_* flags from both inputs */
6520065202
i64 iA; /* Integer value of left operand */
6520165203
i64 iB; /* Integer value of right operand */
6520265204
double rA; /* Real value of left operand */
6520365205
double rB; /* Real value of right operand */
@@ -65211,10 +65213,11 @@
6521165213
u.ah.flags = pIn1->flags | pIn2->flags;
6521265214
if( (u.ah.flags & MEM_Null)!=0 ) goto arithmetic_result_is_null;
6521365215
if( (pIn1->flags & pIn2->flags & MEM_Int)==MEM_Int ){
6521465216
u.ah.iA = pIn1->u.i;
6521565217
u.ah.iB = pIn2->u.i;
65218
+ u.ah.bIntint = 1;
6521665219
switch( pOp->opcode ){
6521765220
case OP_Add: if( sqlite3AddInt64(&u.ah.iB,u.ah.iA) ) goto fp_math; break;
6521865221
case OP_Subtract: if( sqlite3SubInt64(&u.ah.iB,u.ah.iA) ) goto fp_math; break;
6521965222
case OP_Multiply: if( sqlite3MulInt64(&u.ah.iB,u.ah.iA) ) goto fp_math; break;
6522065223
case OP_Divide: {
@@ -65231,10 +65234,11 @@
6523165234
}
6523265235
}
6523365236
pOut->u.i = u.ah.iB;
6523465237
MemSetTypeFlag(pOut, MEM_Int);
6523565238
}else{
65239
+ u.ah.bIntint = 0;
6523665240
fp_math:
6523765241
u.ah.rA = sqlite3VdbeRealValue(pIn1);
6523865242
u.ah.rB = sqlite3VdbeRealValue(pIn2);
6523965243
switch( pOp->opcode ){
6524065244
case OP_Add: u.ah.rB += u.ah.rA; break;
@@ -65262,11 +65266,11 @@
6526265266
if( sqlite3IsNaN(u.ah.rB) ){
6526365267
goto arithmetic_result_is_null;
6526465268
}
6526565269
pOut->r = u.ah.rB;
6526665270
MemSetTypeFlag(pOut, MEM_Real);
65267
- if( (u.ah.flags & MEM_Real)==0 ){
65271
+ if( (u.ah.flags & MEM_Real)==0 && !u.ah.bIntint ){
6526865272
sqlite3VdbeIntegerAffinity(pOut);
6526965273
}
6527065274
#endif
6527165275
}
6527265276
break;
@@ -66011,12 +66015,10 @@
6601166015
6601266016
/* Opcode: Once P1 P2 * * *
6601366017
**
6601466018
** Check if OP_Once flag P1 is set. If so, jump to instruction P2. Otherwise,
6601566019
** set the flag and fall through to the next instruction.
66016
-**
66017
-** See also: JumpOnce
6601866020
*/
6601966021
case OP_Once: { /* jump */
6602066022
assert( pOp->p1<p->nOnceFlag );
6602166023
if( p->aOnceFlag[pOp->p1] ){
6602266024
pc = pOp->p2-1;
6602366025
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -673,11 +673,11 @@
673 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
674 ** [sqlite_version()] and [sqlite_source_id()].
675 */
676 #define SQLITE_VERSION "3.7.15"
677 #define SQLITE_VERSION_NUMBER 3007015
678 #define SQLITE_SOURCE_ID "2012-12-08 22:14:29 92c9ab56b1c67b9468bec57ab1d2c483a69a2810"
679
680 /*
681 ** CAPI3REF: Run-Time Library Version Numbers
682 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
683 **
@@ -64089,10 +64089,11 @@
64089 } af;
64090 struct OP_Concat_stack_vars {
64091 i64 nByte;
64092 } ag;
64093 struct OP_Remainder_stack_vars {
 
64094 int flags; /* Combined MEM_* flags from both inputs */
64095 i64 iA; /* Integer value of left operand */
64096 i64 iB; /* Integer value of right operand */
64097 double rA; /* Real value of left operand */
64098 double rB; /* Real value of right operand */
@@ -65194,10 +65195,11 @@
65194 case OP_Subtract: /* same as TK_MINUS, in1, in2, out3 */
65195 case OP_Multiply: /* same as TK_STAR, in1, in2, out3 */
65196 case OP_Divide: /* same as TK_SLASH, in1, in2, out3 */
65197 case OP_Remainder: { /* same as TK_REM, in1, in2, out3 */
65198 #if 0 /* local variables moved into u.ah */
 
65199 int flags; /* Combined MEM_* flags from both inputs */
65200 i64 iA; /* Integer value of left operand */
65201 i64 iB; /* Integer value of right operand */
65202 double rA; /* Real value of left operand */
65203 double rB; /* Real value of right operand */
@@ -65211,10 +65213,11 @@
65211 u.ah.flags = pIn1->flags | pIn2->flags;
65212 if( (u.ah.flags & MEM_Null)!=0 ) goto arithmetic_result_is_null;
65213 if( (pIn1->flags & pIn2->flags & MEM_Int)==MEM_Int ){
65214 u.ah.iA = pIn1->u.i;
65215 u.ah.iB = pIn2->u.i;
 
65216 switch( pOp->opcode ){
65217 case OP_Add: if( sqlite3AddInt64(&u.ah.iB,u.ah.iA) ) goto fp_math; break;
65218 case OP_Subtract: if( sqlite3SubInt64(&u.ah.iB,u.ah.iA) ) goto fp_math; break;
65219 case OP_Multiply: if( sqlite3MulInt64(&u.ah.iB,u.ah.iA) ) goto fp_math; break;
65220 case OP_Divide: {
@@ -65231,10 +65234,11 @@
65231 }
65232 }
65233 pOut->u.i = u.ah.iB;
65234 MemSetTypeFlag(pOut, MEM_Int);
65235 }else{
 
65236 fp_math:
65237 u.ah.rA = sqlite3VdbeRealValue(pIn1);
65238 u.ah.rB = sqlite3VdbeRealValue(pIn2);
65239 switch( pOp->opcode ){
65240 case OP_Add: u.ah.rB += u.ah.rA; break;
@@ -65262,11 +65266,11 @@
65262 if( sqlite3IsNaN(u.ah.rB) ){
65263 goto arithmetic_result_is_null;
65264 }
65265 pOut->r = u.ah.rB;
65266 MemSetTypeFlag(pOut, MEM_Real);
65267 if( (u.ah.flags & MEM_Real)==0 ){
65268 sqlite3VdbeIntegerAffinity(pOut);
65269 }
65270 #endif
65271 }
65272 break;
@@ -66011,12 +66015,10 @@
66011
66012 /* Opcode: Once P1 P2 * * *
66013 **
66014 ** Check if OP_Once flag P1 is set. If so, jump to instruction P2. Otherwise,
66015 ** set the flag and fall through to the next instruction.
66016 **
66017 ** See also: JumpOnce
66018 */
66019 case OP_Once: { /* jump */
66020 assert( pOp->p1<p->nOnceFlag );
66021 if( p->aOnceFlag[pOp->p1] ){
66022 pc = pOp->p2-1;
66023
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -673,11 +673,11 @@
673 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
674 ** [sqlite_version()] and [sqlite_source_id()].
675 */
676 #define SQLITE_VERSION "3.7.15"
677 #define SQLITE_VERSION_NUMBER 3007015
678 #define SQLITE_SOURCE_ID "2012-12-10 22:19:14 bd7aeeb691fee69dd6a562138a7aba8e8e192272"
679
680 /*
681 ** CAPI3REF: Run-Time Library Version Numbers
682 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
683 **
@@ -64089,10 +64089,11 @@
64089 } af;
64090 struct OP_Concat_stack_vars {
64091 i64 nByte;
64092 } ag;
64093 struct OP_Remainder_stack_vars {
64094 char bIntint; /* Started out as two integer operands */
64095 int flags; /* Combined MEM_* flags from both inputs */
64096 i64 iA; /* Integer value of left operand */
64097 i64 iB; /* Integer value of right operand */
64098 double rA; /* Real value of left operand */
64099 double rB; /* Real value of right operand */
@@ -65194,10 +65195,11 @@
65195 case OP_Subtract: /* same as TK_MINUS, in1, in2, out3 */
65196 case OP_Multiply: /* same as TK_STAR, in1, in2, out3 */
65197 case OP_Divide: /* same as TK_SLASH, in1, in2, out3 */
65198 case OP_Remainder: { /* same as TK_REM, in1, in2, out3 */
65199 #if 0 /* local variables moved into u.ah */
65200 char bIntint; /* Started out as two integer operands */
65201 int flags; /* Combined MEM_* flags from both inputs */
65202 i64 iA; /* Integer value of left operand */
65203 i64 iB; /* Integer value of right operand */
65204 double rA; /* Real value of left operand */
65205 double rB; /* Real value of right operand */
@@ -65211,10 +65213,11 @@
65213 u.ah.flags = pIn1->flags | pIn2->flags;
65214 if( (u.ah.flags & MEM_Null)!=0 ) goto arithmetic_result_is_null;
65215 if( (pIn1->flags & pIn2->flags & MEM_Int)==MEM_Int ){
65216 u.ah.iA = pIn1->u.i;
65217 u.ah.iB = pIn2->u.i;
65218 u.ah.bIntint = 1;
65219 switch( pOp->opcode ){
65220 case OP_Add: if( sqlite3AddInt64(&u.ah.iB,u.ah.iA) ) goto fp_math; break;
65221 case OP_Subtract: if( sqlite3SubInt64(&u.ah.iB,u.ah.iA) ) goto fp_math; break;
65222 case OP_Multiply: if( sqlite3MulInt64(&u.ah.iB,u.ah.iA) ) goto fp_math; break;
65223 case OP_Divide: {
@@ -65231,10 +65234,11 @@
65234 }
65235 }
65236 pOut->u.i = u.ah.iB;
65237 MemSetTypeFlag(pOut, MEM_Int);
65238 }else{
65239 u.ah.bIntint = 0;
65240 fp_math:
65241 u.ah.rA = sqlite3VdbeRealValue(pIn1);
65242 u.ah.rB = sqlite3VdbeRealValue(pIn2);
65243 switch( pOp->opcode ){
65244 case OP_Add: u.ah.rB += u.ah.rA; break;
@@ -65262,11 +65266,11 @@
65266 if( sqlite3IsNaN(u.ah.rB) ){
65267 goto arithmetic_result_is_null;
65268 }
65269 pOut->r = u.ah.rB;
65270 MemSetTypeFlag(pOut, MEM_Real);
65271 if( (u.ah.flags & MEM_Real)==0 && !u.ah.bIntint ){
65272 sqlite3VdbeIntegerAffinity(pOut);
65273 }
65274 #endif
65275 }
65276 break;
@@ -66011,12 +66015,10 @@
66015
66016 /* Opcode: Once P1 P2 * * *
66017 **
66018 ** Check if OP_Once flag P1 is set. If so, jump to instruction P2. Otherwise,
66019 ** set the flag and fall through to the next instruction.
 
 
66020 */
66021 case OP_Once: { /* jump */
66022 assert( pOp->p1<p->nOnceFlag );
66023 if( p->aOnceFlag[pOp->p1] ){
66024 pc = pOp->p2-1;
66025
+1 -1
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107107
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108108
** [sqlite_version()] and [sqlite_source_id()].
109109
*/
110110
#define SQLITE_VERSION "3.7.15"
111111
#define SQLITE_VERSION_NUMBER 3007015
112
-#define SQLITE_SOURCE_ID "2012-12-08 22:14:29 92c9ab56b1c67b9468bec57ab1d2c483a69a2810"
112
+#define SQLITE_SOURCE_ID "2012-12-10 22:19:14 bd7aeeb691fee69dd6a562138a7aba8e8e192272"
113113
114114
/*
115115
** CAPI3REF: Run-Time Library Version Numbers
116116
** KEYWORDS: sqlite3_version, sqlite3_sourceid
117117
**
118118
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.7.15"
111 #define SQLITE_VERSION_NUMBER 3007015
112 #define SQLITE_SOURCE_ID "2012-12-08 22:14:29 92c9ab56b1c67b9468bec57ab1d2c483a69a2810"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
118
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.7.15"
111 #define SQLITE_VERSION_NUMBER 3007015
112 #define SQLITE_SOURCE_ID "2012-12-10 22:19:14 bd7aeeb691fee69dd6a562138a7aba8e8e192272"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
118

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button