When parsing a corrupt record using sqlite3VdbeRecordUnpack(), make sure

that the resulting UnpackedRecord object is completely initialized, to avoid
(harmless) MSAN warnings.

FossilOrigin-Name: ddc3697efd61830fad55c6bf7f9115f4a7f53e08838eba5a82e1406c7a721665
This commit is contained in:
drh 2019-01-14 13:32:15 +00:00
parent 68c1f9ce9a
commit 4067ce7d54
3 changed files with 15 additions and 8 deletions

View File

@ -1,5 +1,5 @@
C Have\sfts3\signore\sempty\ssets\sof\sparenthesis\sif\sbuilt\swith\nSQLITE_ENABLE_FTS3_PARENTHESIS.
D 2019-01-14T11:56:13.183
C When\sparsing\sa\scorrupt\srecord\susing\ssqlite3VdbeRecordUnpack(),\smake\ssure\nthat\sthe\sresulting\sUnpackedRecord\sobject\sis\scompletely\sinitialized,\sto\savoid\n(harmless)\sMSAN\swarnings.
D 2019-01-14T13:32:15.811
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F Makefile.in 45a3fef4d325ac0220c2172aeec4e4321da351f073f3b8e8ddea655f49ef6f2b
@ -587,7 +587,7 @@ F src/vdbe.c 1919d490e97bfc59eab4d43444a53a6717d06137295ed684a25e5df7430d9974
F src/vdbe.h 712bca562eaed1c25506b9faf9680bdc75fc42e2f4a1cd518d883fa79c7a4237
F src/vdbeInt.h a76d5eed62c76bcd8de7afd3147fac1bc40c5a870582664bcd7d071ef437c37f
F src/vdbeapi.c 57a2d794a8833f269b878dbc24e955369bdb379af6c4e93ebc5ce1a20fa3daf4
F src/vdbeaux.c 6e8cf4dd3cf095231af8ecf3c1b986f37e0bad9d7db255d53c1ea6766af7c986
F src/vdbeaux.c c0c3c0820cd4f85f449876a068258f0691c5dbaa5b3f9e3dfa652f56ec101578
F src/vdbeblob.c f5c70f973ea3a9e915d1693278a5f890dc78594300cf4d54e64f2b0917c94191
F src/vdbemem.c 7b3305bc4a5139f4536ac9b5f61da0f915e49d2e3fdfa87dfdfa9d7aba8bc1e9
F src/vdbesort.c 90aad5a92608f2dd771c96749beabdb562c9d881131a860a7a5bccf66dc3be7f
@ -1798,7 +1798,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 cb50509020d952fa9efed8df7fa08b07b71ae9bdbdefea216b6e660863291039
R 513c5d5d05a7bf68768d7506be1c538c
U dan
Z 3cd69cc1dca89ff927ba89ca9d578a1e
P c93c6b45a317c40eb5c0abb6620d21f5821a601632c791e11e5ce62e039eccda
R 3507d4ff938f8a3f9aade20909b41836
U drh
Z 2333778276c1cc3925abbf197e14cec8

View File

@ -1 +1 @@
c93c6b45a317c40eb5c0abb6620d21f5821a601632c791e11e5ce62e039eccda
ddc3697efd61830fad55c6bf7f9115f4a7f53e08838eba5a82e1406c7a721665

View File

@ -3818,6 +3818,13 @@ void sqlite3VdbeRecordUnpack(
pMem++;
if( (++u)>=p->nField ) break;
}
if( d>nKey && u ){
assert( CORRUPT_DB );
/* In a corrupt record entry, the last pMem might have been set up using
** uninitialized memory. Overwrite its value with NULL, to prevent
** warnings from MSAN. */
sqlite3VdbeMemSetNull(pMem-1);
}
assert( u<=pKeyInfo->nKeyField + 1 );
p->nField = u;
}