Ensure that geopoly does not invoke sqlite3_result_error_nomem() with a

NULL pointer.

FossilOrigin-Name: 2483310d15022b47109b44c86e100f5894be7a45a0568dfef6aea80e6c518654
This commit is contained in:
drh 2021-10-05 12:34:54 +00:00
parent e1e1a43a0f
commit 8a0c42765d
4 changed files with 16 additions and 10 deletions

View File

@ -305,13 +305,14 @@ static GeoPoly *geopolyFuncParam(
){
GeoPoly *p = 0;
int nByte;
testcase( pCtx==0 );
if( sqlite3_value_type(pVal)==SQLITE_BLOB
&& (nByte = sqlite3_value_bytes(pVal))>=(4+6*sizeof(GeoCoord))
){
const unsigned char *a = sqlite3_value_blob(pVal);
int nVertex;
if( a==0 ){
sqlite3_result_error_nomem(pCtx);
if( pCtx ) sqlite3_result_error_nomem(pCtx);
return 0;
}
nVertex = (a[1]<<16) + (a[2]<<8) + a[3];

View File

@ -436,7 +436,12 @@ struct RtreeMatchArg {
** it is not, make it a no-op.
*/
#ifndef SQLITE_AMALGAMATION
# define testcase(X)
# ifdef SQLITE_COVERAGE_TEST
unsigned int sqlite3RtreeTestcase = 0;
# define testcase(X) if( X ){ sqlite3RtreeTestcase += __LINE__; }
# else
# define testcase(X)
# endif
#endif
/*

View File

@ -1,5 +1,5 @@
C Simplifications\sto\sthe\spreupdate_hook\slogic\sto\smake\sit\seasier\sto\sreason\sabout,\nand\sreduce\sstatic\sanalyzer\swarnings.
D 2021-10-05T11:11:43.379
C Ensure\sthat\sgeopoly\sdoes\snot\sinvoke\ssqlite3_result_error_nomem()\swith\sa\nNULL\spointer.
D 2021-10-05T12:34:54.148
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -393,8 +393,8 @@ F ext/repair/test/checkfreelist01.test 3e8aa6aeb4007680c94a8d07b41c339aa635cc782
F ext/repair/test/checkindex01.test b530f141413b587c9eb78ff734de6bb79bc3515c335096108c12c01bddbadcec
F ext/repair/test/test.tcl 686d76d888dffd021f64260abf29a55c57b2cedfa7fc69150b42b1d6119aac3c
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
F ext/rtree/geopoly.c d575f6c796fcb8066fb38e3d5c604b31a13867fbee2713ffb190eff31e7bc04d
F ext/rtree/rtree.c bd862b5368c60d3494bcdf6ded2fe743cf0b855a1b2ff4c5b71c82ea0694ecb1
F ext/rtree/geopoly.c 97a4a5b4065fb2c2fe8dd7991b0e0ea3144f3f385a844265f9b2a98ea7a42c51
F ext/rtree/rtree.c f2658ccaf20c65f2c2d7b097e42aa71be7272a3b49af586a57d9eed8ceb8436f
F ext/rtree/rtree.h 4a690463901cb5e6127cf05eb8e642f127012fd5003830dbc974eca5802d9412
F ext/rtree/rtree1.test 35c3bc0def71317b7601ee0d1149e7df2cd8fc4f13ec89a64761ac3f46ca123f
F ext/rtree/rtree2.test 9d9deddbb16fd0c30c36e6b4fdc3ee3132d765567f0f9432ee71e1303d32603d
@ -1929,7 +1929,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 32f33f356931242b59c01b5df7e180941231e3d9c91577ad33aa4a01e9d59092
R 40118fb23ffff22e883bc146535d4ef6
P 91e3b98e06feaa5b70caf2266200d20d0ae4e432db147975c9f5959f93df7e7b
R 50e6d5202614b0113708b86e660afec9
U drh
Z 98cc5429b03c6a7bf82a3053dffda967
Z 4b50cc08c340a52012457074bd6d6040

View File

@ -1 +1 @@
91e3b98e06feaa5b70caf2266200d20d0ae4e432db147975c9f5959f93df7e7b
2483310d15022b47109b44c86e100f5894be7a45a0568dfef6aea80e6c518654