1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

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];