SQLite

Check-in [39534b4b]
Login
Overview
Comment:Adjustment to an extreme corner case in the sqlite3Atoi64() routine.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:39534b4baa53b9360696a9d5ee8cc2108af34592
User & Date: drh 2013-03-28 11:40:14
Context
2013-03-29
13:44
Version 3.7.16.1 check-in: 527231bc user: drh tags: trunk, release, version-3.7.16.1
2013-03-28
11:40
Adjustment to an extreme corner case in the sqlite3Atoi64() routine. check-in: 39534b4b user: drh tags: trunk
2013-03-27
20:41
Fix harmless compiler warnings coming from MSVC64 in test code. No changes to the core. check-in: 274d2a22 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/util.c.

516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
    *pNum = -(i64)u;
  }else{
    *pNum = (i64)u;
  }
  testcase( i==18 );
  testcase( i==19 );
  testcase( i==20 );
  if( (c+nonNum!=0 && &zNum[i]<zEnd) || (i==0 && zStart==zNum) || i>19*incr ){
    /* zNum is empty or contains non-numeric text or is longer
    ** than 19 digits (thus guaranteeing that it is too large) */
    return 1;
  }else if( i<19*incr ){
    /* Less than 19 digits, so we know that it fits in 64 bits */
    assert( u<=LARGEST_INT64 );
    return 0;







|







516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
    *pNum = -(i64)u;
  }else{
    *pNum = (i64)u;
  }
  testcase( i==18 );
  testcase( i==19 );
  testcase( i==20 );
  if( (c!=0 && &zNum[i]<zEnd) || (i==0 && zStart==zNum) || i>19*incr || nonNum ){
    /* zNum is empty or contains non-numeric text or is longer
    ** than 19 digits (thus guaranteeing that it is too large) */
    return 1;
  }else if( i<19*incr ){
    /* Less than 19 digits, so we know that it fits in 64 bits */
    assert( u<=LARGEST_INT64 );
    return 0;