1 |
# Ensure that comparison operators do not mess up the MEM_Dyn flag on registers |
2 |
# when reverting affinity changes. |
3 |
# Upstream original patch: https://www.sqlite.org/src/info/02e3c88fbf6abdcf |
4 |
|
5 |
diff -up sqlite-src-3071700/src/vdbe.c.old sqlite-src-3071700/src/vdbe.c |
6 |
--- sqlite-src-3071700/src/vdbe.c.old 2015-07-23 11:54:21.781280736 +0200 |
7 |
+++ sqlite-src-3071700/src/vdbe.c 2015-07-23 11:58:24.829703086 +0200 |
8 |
@@ -1852,7 +1852,13 @@ case OP_Ge: { /* same as TK_ |
9 |
affinity = pOp->p5 & SQLITE_AFF_MASK; |
10 |
if( affinity ){ |
11 |
applyAffinity(pIn1, affinity, encoding); |
12 |
+ testcase( (flags1&MEM_Dyn) != (pIn1->flags&MEM_Dyn) ); |
13 |
+ flags1 = (pIn1->flags & ~MEM_TypeMask) | (flags1 & MEM_TypeMask); |
14 |
+ |
15 |
applyAffinity(pIn3, affinity, encoding); |
16 |
+ testcase( (flags3&MEM_Dyn) != (pIn3->flags&MEM_Dyn) ); |
17 |
+ flags3 = (pIn3->flags & ~MEM_TypeMask) | (flags3 & MEM_TypeMask); |
18 |
+ |
19 |
if( db->mallocFailed ) goto no_mem; |
20 |
} |
21 |
|
22 |
@@ -1881,7 +1887,9 @@ case OP_Ge: { /* same as TK_ |
23 |
} |
24 |
|
25 |
/* Undo any changes made by applyAffinity() to the input registers. */ |
26 |
+ assert( (pIn1->flags & MEM_Dyn) == (flags1 & MEM_Dyn) ); |
27 |
pIn1->flags = (pIn1->flags&~MEM_TypeMask) | (flags1&MEM_TypeMask); |
28 |
+ assert( (pIn3->flags & MEM_Dyn) == (flags3 & MEM_Dyn) ); |
29 |
pIn3->flags = (pIn3->flags&~MEM_TypeMask) | (flags3&MEM_TypeMask); |
30 |
break; |
31 |
} |