mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
In the rtreedepth() function, detect OOM when converting a zeroblob() on
input. dbsqlfuzz ed23eda7cc3a8a054f85ea19d55c59ba2ca72744. FossilOrigin-Name: 69f843c8fa6e21500b5777169c3b394453ba818b4e32427428480dca5b4ed615
This commit is contained in:
@ -3890,11 +3890,16 @@ static void rtreedepth(sqlite3_context *ctx, int nArg, sqlite3_value **apArg){
|
||||
UNUSED_PARAMETER(nArg);
|
||||
if( sqlite3_value_type(apArg[0])!=SQLITE_BLOB
|
||||
|| sqlite3_value_bytes(apArg[0])<2
|
||||
|
||||
){
|
||||
sqlite3_result_error(ctx, "Invalid argument to rtreedepth()", -1);
|
||||
}else{
|
||||
u8 *zBlob = (u8 *)sqlite3_value_blob(apArg[0]);
|
||||
sqlite3_result_int(ctx, readInt16(zBlob));
|
||||
if( zBlob ){
|
||||
sqlite3_result_int(ctx, readInt16(zBlob));
|
||||
}else{
|
||||
sqlite3_result_error_nomem(ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user