Ignore:
Timestamp:
Jul 16, 2008, 3:14:03 AM (17 years ago)
Author:
Simon Hausmann
Message:

2008-07-16 Ariya Hidayat <[email protected]>

Reviewed by Simon.

http://trolltech.com/developer/task-tracker/index_html?method=entry&id=216179
Fix potential crash (on Qt for Windows port) when performing JavaScript date
conversion.

  • kjs/DateMath.cpp: (KJS::getLocalTime): For the Qt port, prefer to use Windows code, i.e. localtime_s() instead of localtime() since the latter might crash (on Windows) given a non-sensible, e.g. NaN, argument.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/DateMath.cpp

    r34922 r35198  
    310310void getLocalTime(const time_t* localTime, struct tm* localTM)
    311311{
    312 #if PLATFORM(QT)
     312#if PLATFORM(WIN_OS)
     313#if COMPILER(MSVC7)
     314    *localTM = *localtime(localTime);
     315#else
     316    localtime_s(localTM, localTime);
     317#endif
     318#elif PLATFORM(QT)
    313319#if USE(MULTIPLE_THREADS)
    314 #error Mulitple threads are currently not supported in the Qt/mingw build
     320#error Multiple threads are currently not supported in the Qt/mingw build
    315321#endif
    316322    *localTM = *localtime(localTime);
    317 #elif PLATFORM(WIN_OS)
    318     #if COMPILER(MSVC7)
    319     *localTM = *localtime(localTime);
    320     #else
    321     localtime_s(localTM, localTime);
    322     #endif
    323323#else
    324324    localtime_r(localTime, localTM);
Note: See TracChangeset for help on using the changeset viewer.