1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-01-06 08:01:16 +03:00

Avoid a segfault if NULL is passed as the first argument to SQL scalar function fts3_tokenizer().

FossilOrigin-Name: 6d0989695b486275824c14d5f88357267c1e8104
This commit is contained in:
dan
2015-03-21 19:35:09 +00:00
parent d2f99333cf
commit e10d87f65a
4 changed files with 22 additions and 10 deletions

View File

@@ -69,7 +69,7 @@ static void scalarFunc(
if( argc==2 ){
void *pOld;
int n = sqlite3_value_bytes(argv[1]);
if( n!=sizeof(pPtr) ){
if( zName==0 || n!=sizeof(pPtr) ){
sqlite3_result_error(context, "argument type mismatch", -1);
return;
}
@@ -80,7 +80,9 @@ static void scalarFunc(
return;
}
}else{
pPtr = sqlite3Fts3HashFind(pHash, zName, nName);
if( zName ){
pPtr = sqlite3Fts3HashFind(pHash, zName, nName);
}
if( !pPtr ){
char *zErr = sqlite3_mprintf("unknown tokenizer: %s", zName);
sqlite3_result_error(context, zErr, -1);