mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Prevent a possible segfault when the sqlite3_value_numeric_type() interface is
misused to try to determine the numeric type of the NULL value returned from sqlite3_column_value() with an invalid column number. FossilOrigin-Name: 501b743bcb60cda0acf63bcf8a4abbf00797b347
This commit is contained in:
@@ -311,13 +311,13 @@ static void applyAffinity(
|
||||
** into a numeric representation. Use either INTEGER or REAL whichever
|
||||
** is appropriate. But only do the conversion if it is possible without
|
||||
** loss of information and return the revised type of the argument.
|
||||
**
|
||||
** This is an EXPERIMENTAL api and is subject to change or removal.
|
||||
*/
|
||||
int sqlite3_value_numeric_type(sqlite3_value *pVal){
|
||||
Mem *pMem = (Mem*)pVal;
|
||||
applyNumericAffinity(pMem);
|
||||
sqlite3VdbeMemStoreType(pMem);
|
||||
if( pMem->type==SQLITE_TEXT ){
|
||||
applyNumericAffinity(pMem);
|
||||
sqlite3VdbeMemStoreType(pMem);
|
||||
}
|
||||
return pMem->type;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user