]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Do not allow a Mem object to be both NULL and some other type at the same time.
authordrh <drh@noemail.net>
Mon, 17 Apr 2017 20:50:34 +0000 (20:50 +0000)
committerdrh <drh@noemail.net>
Mon, 17 Apr 2017 20:50:34 +0000 (20:50 +0000)
FossilOrigin-Name: e698db1956bb3aba32cd3ec633ec20f5d19b1a10bc68d3772903bca3c87ee158

manifest
manifest.uuid
src/vdbe.c
src/vdbemem.c

index 626df9e1b2b08429711299f75a0fdf3bc61f5218..d1988023137e53888110f2250a1002b4cf128c0f 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Consolidate\stwo\sbranches\sof\scode\sin\sthe\s"PRAGMA\sforeign_key_check"\nimplementation.
-D 2017-04-17T18:42:33.368
+C Do\snot\sallow\sa\sMem\sobject\sto\sbe\sboth\sNULL\sand\ssome\sother\stype\sat\sthe\ssame\stime.
+D 2017-04-17T20:50:34.840
 F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 6a8c838220f7c00820e1fc0ac1bccaaa8e5676067e1dbfa1bafa7a4ffecf8ae6
@@ -469,13 +469,13 @@ F src/update.c c443935c652af9365e033f756550b5032d02e1b06eb2cb890ed7511ae0c051dc
 F src/utf.c 699001c79f28e48e9bcdf8a463da029ea660540c
 F src/util.c ca8440ede81e155d15cff7c101654f60b55a9ae6
 F src/vacuum.c 1fe4555cd8c9b263afb85b5b4ee3a4a4181ad569
-F src/vdbe.c 808fda3d50f544120d27c731449b524b4ec8f8b0f734b228831078f0ba53ecb9
+F src/vdbe.c 51c6e166aa208882f28647c2fe59b71326b401f5a45bd5a2f1d3054aa08b33fd
 F src/vdbe.h f7d1456e28875c2dcb964056589b5b7149ab7edf39edeca801596a39bb3d3848
 F src/vdbeInt.h c070bc5c8b913bda0ceaa995cd4d939ded5e4fc96cf7c3c1c602d41b871f8ade
 F src/vdbeapi.c 5b08d82592bcff4470601fe78aaabebd50837860
 F src/vdbeaux.c 6b3f6ce909e206d4c918988b13b7fa687e92b4471d137e0f2a37edac80ec60be
 F src/vdbeblob.c 359891617358deefc85bef7bcf787fa6b77facb9
-F src/vdbemem.c 3122f5a21064198c10ee1b4686937aab27d5395712d9af905b7fa1affc47a453
+F src/vdbemem.c 2c70f8f5de6c71fb99a22c5b83be9fab5c47cdd8e279fa44a8c00cfed06d7e89
 F src/vdbesort.c e72fe02a2121386ba767ede8942e9450878b8fc873abf3d1b6824485f092570c
 F src/vdbetrace.c 41963d5376f0349842b5fc4aaaaacd7d9cdc0834
 F src/vtab.c 007513c2ef52472fcdea6a741683d50662e82790
@@ -1575,7 +1575,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 690870bd7b2e607b7992c4496c9f08c29eb72a36af002c606fd7aa3dcf94a2a4
-R 19c8be4cdee10493f553df8030d2fc52
-U dan
-Z 1848b8fa31243e1c51d1bf2e158fcffc
+P 69f51f838abcf57b35e41f7a10fbb45f56536f93825aac865debc3c8315930be
+R 64888a299504d2f3a6ae0f4b59c9c8bb
+U drh
+Z cefc6e2d5ac1cd873685a6b283e84cfc
index 7995338c75dd0ca3d316847ecf52d1b4e6c74677..1d21d6cd2b2be8f819dd8aef441096df1e2b5c11 100644 (file)
@@ -1 +1 @@
-69f51f838abcf57b35e41f7a10fbb45f56536f93825aac865debc3c8315930be
\ No newline at end of file
+e698db1956bb3aba32cd3ec633ec20f5d19b1a10bc68d3772903bca3c87ee158
\ No newline at end of file
index a990afb11d148b6657401923f19d49b991729bad..ebd304ecb60b0679986d9aa7e6b009ed3742207b 100644 (file)
@@ -486,6 +486,7 @@ static void registerTrace(int iReg, Mem *p){
   printf("REG[%d] = ", iReg);
   memTracePrint(p);
   printf("\n");
+  sqlite3VdbeCheckMemInvariants(p);
 }
 #endif
 
@@ -1151,7 +1152,7 @@ case OP_Null: {           /* out2 */
 case OP_SoftNull: {
   assert( pOp->p1>0 && pOp->p1<=(p->nMem+1 - p->nCursor) );
   pOut = &aMem[pOp->p1];
-  pOut->flags = (pOut->flags|MEM_Null)&~MEM_Undefined;
+  pOut->flags = (pOut->flags&~(MEM_Undefined|MEM_AffMask))|MEM_Null;
   break;
 }
 
index 4f578937672925521b1da9c703a91d2bc7612556..e95a8d1b9d7b38635540bb4513b4cb006a7a2697 100644 (file)
@@ -40,6 +40,10 @@ int sqlite3VdbeCheckMemInvariants(Mem *p){
   /* Cannot be both MEM_Int and MEM_Real at the same time */
   assert( (p->flags & (MEM_Int|MEM_Real))!=(MEM_Int|MEM_Real) );
 
+  /* Cannot be both MEM_Null and some other type */
+  assert( (p->flags & MEM_Null)==0 ||
+          (p->flags & (MEM_Int|MEM_Real|MEM_Str|MEM_Blob))==0 );
+
   /* The szMalloc field holds the correct memory allocation size */
   assert( p->szMalloc==0
        || p->szMalloc==sqlite3DbMallocSize(p->db,p->zMalloc) );