Simplified OOM detection in the instr() SQL function.

FossilOrigin-Name: 6d85eb5736781b43aa674d9544c7523b849b4e634f371702f8764b33e22e1e9f
This commit is contained in:
drh
2017-03-16 14:28:52 +00:00
parent 85c2dc0ae6
commit b30574bcae
3 changed files with 8 additions and 12 deletions
+1 -5
View File
@@ -205,16 +205,12 @@ static void instrFunc(
zHaystack = sqlite3_value_blob(argv[0]);
zNeedle = sqlite3_value_blob(argv[1]);
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]);
isText = 1;
if( zHaystack==0 || zNeedle==0 ) return;
}
if( zNeedle==0 || (nHaystack && zHaystack==0) ) return;
while( nNeedle<=nHaystack && memcmp(zHaystack, zNeedle, nNeedle)!=0 ){
N++;
do{