isc_decode_timestamp() unconditionally sets tm_isdst to 0 in the output struct 
tm
---------------------------------------------------------------------------------

                 Key: CORE-3877
                 URL: http://tracker.firebirdsql.org/browse/CORE-3877
             Project: Firebird Core
          Issue Type: Bug
          Components: API / Client Library
    Affects Versions: 2.1.4
         Environment: Platform-independent.
            Reporter: Vadim Zeitlin
            Priority: Minor


The function TimeStamp::decode() used by public isc_decode_timestamp() 
functions always returns struct tm with its tm_isdst field set to 0 due to a 
memset() of the whole struct to 0 that is done in the beginning of 
TimeStamp::decode_date() called by it.

I believe this is wrong as it means that passing the result of localtime() to 
isc_encode_timestamp() and then using mktime() with the result of 
isc_decode_timestamp() gives a different value from the one you started with 
when the DST is in effect.

Ideal would probably be to correctly determine whether the DST is in effect or 
not but as a minimal fix just setting tm_isdst to -1 in TimeStamp::decode() 
would be good enough.

Notice that while I encountered this problem with 2.1.4, the code in the latest 
svn didn't change except that it's now in a different file, see 
http://firebird.svn.sourceforge.net/viewvc/firebird/firebird/trunk/src/common/classes/NoThrowTimeStamp.cpp?view=markup

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to