mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
The sqlite3_result_text() routine (and similar) should record OOM errors
in addition to SQLITE_TOOBIG errors. dbsqlfuzz FossilOrigin-Name: eca434362652fe2edd6090b29417b35bc88a170609810aa9d266f6fc27baeab8
This commit is contained in:
@@ -362,8 +362,8 @@ void sqlite3_value_free(sqlite3_value *pOld){
|
||||
** the function result.
|
||||
**
|
||||
** The setStrOrError() function calls sqlite3VdbeMemSetStr() to store the
|
||||
** result as a string or blob but if the string or blob is too large, it
|
||||
** then sets the error code to SQLITE_TOOBIG
|
||||
** result as a string or blob. Appropriate errors are set if the string/blob
|
||||
** is too big or if an OOM occurs.
|
||||
**
|
||||
** The invokeValueDestructor(P,X) routine invokes destructor function X()
|
||||
** on value P is not going to be used and need to be destroyed.
|
||||
@@ -375,8 +375,16 @@ static void setResultStrOrError(
|
||||
u8 enc, /* Encoding of z. 0 for BLOBs */
|
||||
void (*xDel)(void*) /* Destructor function */
|
||||
){
|
||||
if( sqlite3VdbeMemSetStr(pCtx->pOut, z, n, enc, xDel)==SQLITE_TOOBIG ){
|
||||
sqlite3_result_error_toobig(pCtx);
|
||||
int rc = sqlite3VdbeMemSetStr(pCtx->pOut, z, n, enc, xDel);
|
||||
if( rc ){
|
||||
if( rc==SQLITE_TOOBIG ){
|
||||
sqlite3_result_error_toobig(pCtx);
|
||||
}else{
|
||||
/* The only errors possible from sqlite3VdbeMemSetStr are
|
||||
** SQLITE_TOOBIG and SQLITE_NOMEM */
|
||||
assert( rc==SQLITE_NOMEM );
|
||||
sqlite3_result_error_nomem(pCtx);
|
||||
}
|
||||
}
|
||||
}
|
||||
static int invokeValueDestructor(
|
||||
|
Reference in New Issue
Block a user