aboutsummaryrefslogtreecommitdiff
path: root/src/expr.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2007-10-23 18:55:48 +0000
committerdrh <drh@noemail.net>2007-10-23 18:55:48 +0000
commit0cf19ed817154cddce218032b7174c063adf5e73 (patch)
tree513461567551e1e18f809480830bd074b8ac6eaf /src/expr.c
parent9e0ebbfa41445a2ad4b6e563ddea41f6ac40469c (diff)
downloadsqlite-0cf19ed817154cddce218032b7174c063adf5e73.tar.gz
sqlite-0cf19ed817154cddce218032b7174c063adf5e73.zip
Add comments, assertions, and test cases to demonstrate that the
problem described in ticket #2742 is not a real problem. (CVS 4510) FossilOrigin-Name: c085d6dfc0f5849113986cb2a25e64d0c95b3dfb
Diffstat (limited to 'src/expr.c')
-rw-r--r--src/expr.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/expr.c b/src/expr.c
index f196ba19c..4f3d52779 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -12,7 +12,7 @@
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
-** $Id: expr.c,v 1.314 2007/10/23 15:39:45 drh Exp $
+** $Id: expr.c,v 1.315 2007/10/23 18:55:49 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -1694,12 +1694,17 @@ static char *dup8bytes(Vdbe *v, const char *in){
/*
** Generate an instruction that will put the floating point
** value described by z[0..n-1] on the stack.
+**
+** The z[] string will probably not be zero-terminated. But the
+** z[n] character is guaranteed to be something that does not look
+** like the continuation of the number.
*/
static void codeReal(Vdbe *v, const char *z, int n, int negateFlag){
assert( z || v==0 || sqlite3VdbeDb(v)->mallocFailed );
if( z ){
double value;
char *zV;
+ assert( !isdigit(z[n]) );
sqlite3AtoF(z, &value);
if( negateFlag ) value = -value;
zV = dup8bytes(v, (char*)&value);
@@ -1711,11 +1716,16 @@ static void codeReal(Vdbe *v, const char *z, int n, int negateFlag){
/*
** Generate an instruction that will put the integer describe by
** text z[0..n-1] on the stack.
+**
+** The z[] string will probably not be zero-terminated. But the
+** z[n] character is guaranteed to be something that does not look
+** like the continuation of the number.
*/
static void codeInteger(Vdbe *v, const char *z, int n, int negateFlag){
assert( z || v==0 || sqlite3VdbeDb(v)->mallocFailed );
if( z ){
int i;
+ assert( !isdigit(z[n]) );
if( sqlite3GetInt32(z, &i) ){
if( negateFlag ) i = -i;
sqlite3VdbeAddOp(v, OP_Integer, i, 0);