8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 00:03:03 +01:00

Postfix for CORE-4789 - Prohibit ability to cast timestamps that out of valid range to varchar.

This commit is contained in:
asfernandes 2015-05-17 02:21:52 +00:00
parent 26b1542990
commit 45dbb01236
2 changed files with 4 additions and 0 deletions

View File

@ -52,9 +52,11 @@ namespace Firebird {
class TimeStamp
{
public:
static const ISC_DATE MIN_DATE = -678575; // 01.01.0001
static const ISC_DATE MAX_DATE = 2973483; // 31.12.9999
private:
static const ISC_DATE BAD_DATE = MAX_SLONG;
static const ISC_TIME BAD_TIME = MAX_ULONG;

View File

@ -1504,6 +1504,8 @@ dsc* evlDateAdd(Jrd::thread_db* tdbb, const SysFunction* function, Jrd::jrd_nod*
{
case dtype_sql_time:
timestamp.value().timestamp_time = *(GDS_TIME*) valueDsc->dsc_address;
timestamp.value().timestamp_date =
(TimeStamp::MAX_DATE - TimeStamp::MIN_DATE) / 2 + TimeStamp::MIN_DATE;
if (part != blr_extract_hour &&
part != blr_extract_minute &&