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
diff --git a/src/expr.c b/src/expr.c
index f196ba1..4f3d527 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 @@
/*
** 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 @@
/*
** 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);