SQLITE_NOTICE(283): recovered 1 frames from WAL file /fossil/sqlite.fossil-wal

SQLite: Check-in [3c58b173]
/ Check-in [3c58b173]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Fix a potential integer overflow during out-of-bound date computations.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | date-overflow-fix
Files: files | file ages | folders
SHA1: 3c58b173d90f2fbf7a1de7eb0177a0a10abe14fa
User & Date: drh 2016-12-02 14:15:13
Context
2016-12-02
14:15
Fix a potential integer overflow during out-of-bound date computations. Closed-Leaf check-in: 3c58b173 user: drh tags: date-overflow-fix
02:19
Test cases for the improved LIKE/GLOB matcher. check-in: 0bdb7ae1 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/date.c.
837
838
839
840
841
842
843






844
845
846
847
848
849
850
851
    z = sqlite3_value_text(argv[0]);
    if( !z || parseDateOrTime(context, (char*)z, p) ){
      return 1;
    }
  }
  for(i=1; i<argc; i++){
    z = sqlite3_value_text(argv[i]);






    if( z==0 || parseModifier(context, (char*)z, p) ) return 1;
  }
  computeJD(p);
  if( p->isError || !validJulianDay(p->iJD) ) return 1;
  return 0;
}









>
>
>
>
>
>
|







837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
    z = sqlite3_value_text(argv[0]);
    if( !z || parseDateOrTime(context, (char*)z, p) ){
      return 1;
    }
  }
  for(i=1; i<argc; i++){
    z = sqlite3_value_text(argv[i]);
    if( z==0 ) return 1;
    if( p->validJD && !validJulianDay(p->iJD) 
     && strcmp((const char*)z,"unixepoch")!=0
    ){
      return 1;
    }
    if( parseModifier(context, (char*)z, p) ) return 1;
  }
  computeJD(p);
  if( p->isError || !validJulianDay(p->iJD) ) return 1;
  return 0;
}


Changes to test/date.test.
591
592
593
594
595
596
597

598
599
600
datetest 16.25 {datetime(5373484,'-128963628 hours')} NULL
datetest 16.26 {datetime(5373484,'-5373484 days')} {-4713-11-24 12:00:00}
datetest 16.27 {datetime(5373484,'-5373485 days')} NULL
datetest 16.28 {datetime(5373484,'-176545 months')} {-4713-12-01 12:00:00}
datetest 16.29 {datetime(5373484,'-176546 months')} NULL
datetest 16.30 {datetime(5373484,'-14712 years')} {-4713-12-31 12:00:00}
datetest 16.31 {datetime(5373484,'-14713 years')} NULL



finish_test







>

<

591
592
593
594
595
596
597
598
599

600
datetest 16.25 {datetime(5373484,'-128963628 hours')} NULL
datetest 16.26 {datetime(5373484,'-5373484 days')} {-4713-11-24 12:00:00}
datetest 16.27 {datetime(5373484,'-5373485 days')} NULL
datetest 16.28 {datetime(5373484,'-176545 months')} {-4713-12-01 12:00:00}
datetest 16.29 {datetime(5373484,'-176546 months')} NULL
datetest 16.30 {datetime(5373484,'-14712 years')} {-4713-12-31 12:00:00}
datetest 16.31 {datetime(5373484,'-14713 years')} NULL
datetest 16.32 {datetime('-5e19','-01:00')} NULL


finish_test