Fix a potential NULL pointer dereference in the CLI logic for printing the

schema of virtual tables.

FossilOrigin-Name: fe44ebf6be47e1c7f2458297669dbd2b882a31595ea8759f7e8bb024ffc44d11
This commit is contained in:
drh 2021-12-16 13:56:04 +00:00
parent e3e2565daa
commit 511b118dd2
3 changed files with 11 additions and 9 deletions

View File

@ -1,5 +1,5 @@
C Add\smore\stests\sfor\sOOM\sconditions\sin\sthe\sCLI.
D 2021-12-16T13:29:28.610
C Fix\sa\spotential\sNULL\spointer\sdereference\sin\sthe\sCLI\slogic\sfor\sprinting\sthe\nschema\sof\svirtual\stables.
D 2021-12-16T13:56:04.308
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -552,7 +552,7 @@ F src/random.c 097dc8b31b8fba5a9aca1697aeb9fd82078ec91be734c16bffda620ced7ab83c
F src/resolve.c 4a1db4aadd802683db40ca2dbbb268187bd195f10cbdb7206dbd8ac988795571
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
F src/select.c a7a3d9f54eb24821ec5f67f2e5589b68a5d42d46fc5849d7376886777d93a85a
F src/shell.c.in 487402a1242eda123a7765415765c2ba5fd80b251af968ac5cd753a21361dca7
F src/shell.c.in ee436c66e767f9ade478d6026dc96ed010ce9984d6bb0a05ee7295d4a6a5d8aa
F src/sqlite.h.in 5999d6db0e65afbd686b76cddc385b310aa3815624edba43987913067f50e209
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 8ff2fd2c166150b2e48639f5e506fb44e29f1a3f65031710b9e89d1c126ac839
@ -1934,7 +1934,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 241dc0428a6e0238c57e2449e98ea60047e777e29c83a4ebe6da16f7cba40e19
R c242be18b9914b844987d57ba93b7d7b
P b6fa402d159b2475a7b99ef6a5180d7bf800f90afe28cea726d346d071405045
R deeacfaf4293a19f1f0da5da107a5410
U drh
Z 275dad0e920745aee275fd4bee05334a
Z c97827e8de3c5a52ec9e189c6ecc8d7b

View File

@ -1 +1 @@
b6fa402d159b2475a7b99ef6a5180d7bf800f90afe28cea726d346d071405045
fe44ebf6be47e1c7f2458297669dbd2b882a31595ea8759f7e8bb024ffc44d11

View File

@ -961,9 +961,11 @@ static void shellModuleSchema(
int nVal,
sqlite3_value **apVal
){
const char *zName = (const char*)sqlite3_value_text(apVal[0]);
char *zFake = shellFakeSchema(sqlite3_context_db_handle(pCtx), 0, zName);
const char *zName;
char *zFake;
UNUSED_PARAMETER(nVal);
zName = (const char*)sqlite3_value_text(apVal[0]);
zFake = zName ? shellFakeSchema(sqlite3_context_db_handle(pCtx), 0, zName) : 0;
if( zFake ){
sqlite3_result_text(pCtx, sqlite3_mprintf("/* %s */", zFake),
-1, sqlite3_free);