diff options
author | drh <drh@noemail.net> | 2010-11-18 12:31:24 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2010-11-18 12:31:24 +0000 |
commit | e5a8a1df0d44a3df70c31bcbfefa19e07fd912e8 (patch) | |
tree | 464361262a4cb7a0aeae7ff9017c8125988da15b /src | |
parent | 79d086dffca88b4eed942776313b3eac66dcad3a (diff) | |
download | sqlite-e5a8a1df0d44a3df70c31bcbfefa19e07fd912e8.tar.gz sqlite-e5a8a1df0d44a3df70c31bcbfefa19e07fd912e8.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/vdbe.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/vdbe.c b/src/vdbe.c index 02d1a406c..cfcb15bbd 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -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; } |