mirror of
https://github.com/sqlite/sqlite.git
synced 2025-10-22 22:13:04 +03:00
Fix a crash that could follow an OOM condition in the instr() SQL function.
FossilOrigin-Name: 6e59e903e4e956617bddef0b94e5cae02d724ac8145940b57ab5b0f628759736
This commit is contained in:
@@ -204,9 +204,11 @@ static void instrFunc(
|
||||
if( typeHaystack==SQLITE_BLOB && typeNeedle==SQLITE_BLOB ){
|
||||
zHaystack = sqlite3_value_blob(argv[0]);
|
||||
zNeedle = sqlite3_value_blob(argv[1]);
|
||||
assert( zNeedle!=0 );
|
||||
assert( zHaystack!=0 || nHaystack==0 );
|
||||
isText = 0;
|
||||
/* The following condition may be true if the arguments passed to this
|
||||
** function are values returned by zeroblob() or similar and an OOM
|
||||
** occurs while expanding the blob value. */
|
||||
if( zNeedle==0 || (nHaystack && zHaystack==0) ) return;
|
||||
}else{
|
||||
zHaystack = sqlite3_value_text(argv[0]);
|
||||
zNeedle = sqlite3_value_text(argv[1]);
|
||||
|
Reference in New Issue
Block a user