diff options
author | stephan <stephan@noemail.net> | 2023-01-27 05:37:24 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2023-01-27 05:37:24 +0000 |
commit | 87ce1ff7f72621cb8a8a99dc93141d253899eba0 (patch) | |
tree | 12fa4c9ac1b133103409ce907c467f987ddbeb19 /src/vdbeapi.c | |
parent | cdcb84ef00da4a9b367e6536149634f633c41c71 (diff) | |
parent | ca86a5351e39bbdba0ec38ed06d28a1a2dca504f (diff) | |
download | sqlite-87ce1ff7f72621cb8a8a99dc93141d253899eba0.tar.gz sqlite-87ce1ff7f72621cb8a8a99dc93141d253899eba0.zip |
Merge trunk into wasi-patches branch.
FossilOrigin-Name: 2ce89f5efcdb8b4c58eb2d30833a76d79ae0134c31d5ab8564be9e1cf5a1f4f0
Diffstat (limited to 'src/vdbeapi.c')
-rw-r--r-- | src/vdbeapi.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/vdbeapi.c b/src/vdbeapi.c index e080449c5..476b6a2ad 100644 --- a/src/vdbeapi.c +++ b/src/vdbeapi.c @@ -883,6 +883,17 @@ int sqlite3_vtab_nochange(sqlite3_context *p){ } /* +** The destructor function for a ValueList object. This needs to be +** a separate function, unknowable to the application, to ensure that +** calls to sqlite3_vtab_in_first()/sqlite3_vtab_in_next() that are not +** preceeded by activation of IN processing via sqlite3_vtab_int() do not +** try to access a fake ValueList object inserted by a hostile extension. +*/ +void sqlite3VdbeValueListFree(void *pToDelete){ + sqlite3_free(pToDelete); +} + +/* ** Implementation of sqlite3_vtab_in_first() (if bNext==0) and ** sqlite3_vtab_in_next() (if bNext!=0). */ @@ -896,8 +907,15 @@ static int valueFromValueList( *ppOut = 0; if( pVal==0 ) return SQLITE_MISUSE; - pRhs = (ValueList*)sqlite3_value_pointer(pVal, "ValueList"); - if( pRhs==0 ) return SQLITE_MISUSE; + if( (pVal->flags & MEM_Dyn)==0 || pVal->xDel!=sqlite3VdbeValueListFree ){ + return SQLITE_ERROR; + }else{ + assert( (pVal->flags&(MEM_TypeMask|MEM_Term|MEM_Subtype)) == + (MEM_Null|MEM_Term|MEM_Subtype) ); + assert( pVal->eSubtype=='p' ); + assert( pVal->u.zPType!=0 && strcmp(pVal->u.zPType,"ValueList")==0 ); + pRhs = (ValueList*)pVal->z; + } if( bNext ){ rc = sqlite3BtreeNext(pRhs->pCsr, 0); }else{ |