1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Add some tests for malloc() failure within the column_name() and column_decl() APIs. (CVS 2805)

FossilOrigin-Name: 78f10ca0a6a02e9e8e6811489841a19e213f3afb
This commit is contained in:
danielk1977
2005-12-07 06:27:43 +00:00
parent f4208043d6
commit 00fd957b78
9 changed files with 166 additions and 31 deletions

View File

@@ -58,7 +58,7 @@ sqlite_int64 sqlite3_value_int64(sqlite3_value *pVal){
return sqlite3VdbeIntValue((Mem*)pVal);
}
const unsigned char *sqlite3_value_text(sqlite3_value *pVal){
return (const char *)sqlite3ValueText(pVal, SQLITE_UTF8);
return (const unsigned char *)sqlite3ValueText(pVal, SQLITE_UTF8);
}
#ifndef SQLITE_OMIT_UTF16
const void *sqlite3_value_text16(sqlite3_value* pVal){
@@ -439,6 +439,7 @@ static const void *columnName(
const void *(*xFunc)(Mem*),
int useType
){
const void *ret;
Vdbe *p = (Vdbe *)pStmt;
int n = sqlite3_column_count(pStmt);
@@ -446,7 +447,13 @@ static const void *columnName(
return 0;
}
N += useType*n;
return xFunc(&p->aColName[N]);
ret = xFunc(&p->aColName[N]);
/* A malloc may have failed inside of the xFunc() call. If this is the case,
** clear the mallocFailed flag and return NULL.
*/
sqlite3ClearMallocFailed();
return ret;
}