/ Check-in [25b89630]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Off-by-one error in the CAST to NUMERIC logic.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 25b89630206fdbb41c756e98f99baa711d35a8c226697a92339d0fe7e8b3652a
User & Date: drh 2019-06-11 16:06:05
Context
2019-06-11
16:07
New test case in fuzzdata8.db. check-in: e96641f0 user: drh tags: trunk
16:06
Off-by-one error in the CAST to NUMERIC logic. check-in: 25b89630 user: drh tags: trunk
12:03
Have the ALTER TABLE code handle the case where an entire expression that includes a sub-select is excluded from a view, trigger or index. check-in: f2c8179f user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to src/vdbemem.c.

696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
** For some versions of GCC on 32-bit machines, if you do the more obvious
** comparison of "r1==(double)i" you sometimes get an answer of false even
** though the r1 and (double)i values are bit-for-bit the same.
*/
int sqlite3RealSameAsInt(double r1, sqlite3_int64 i){
  double r2 = (double)i;
  return memcmp(&r1, &r2, sizeof(r1))==0
      && i > -2251799813685248 && i < 2251799813685248;
}

/*
** Convert pMem so that it has type MEM_Real or MEM_Int.
** Invalidate any prior representations.
**
** Every effort is made to force the conversion, even if the input







|







696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
** For some versions of GCC on 32-bit machines, if you do the more obvious
** comparison of "r1==(double)i" you sometimes get an answer of false even
** though the r1 and (double)i values are bit-for-bit the same.
*/
int sqlite3RealSameAsInt(double r1, sqlite3_int64 i){
  double r2 = (double)i;
  return memcmp(&r1, &r2, sizeof(r1))==0
      && i >= -2251799813685248 && i < 2251799813685248;
}

/*
** Convert pMem so that it has type MEM_Real or MEM_Int.
** Invalidate any prior representations.
**
** Every effort is made to force the conversion, even if the input