You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Vikas Mehta (JIRA)" <ji...@apache.org> on 2006/01/02 03:50:01 UTC

[jira] Created: (STDCXX-93) time_get crashes when calling get_date ( Visual C++ 8.0 )

time_get crashes when calling get_date ( Visual C++ 8.0 )
---------------------------------------------------------

         Key: STDCXX-93
         URL: http://issues.apache.org/jira/browse/STDCXX-93
     Project: STDCXX
        Type: Bug
  Components: Examples  
 Environment: Visual C++ 8.0
    Reporter: Vikas Mehta


Test case:
// Following code snippet is taken from examples\manual\time_get.cpp

// NOTE: A SunPro bug requires time.h preceed locale. PR #26255
#include <ctime>      // for struct tm
#include <locale>     // for locale, time_get
#include <sstream>    // for stringstream
#include <iostream>   // for cout, endl


// Print out a tm struct value in one atomic operation
std::ostream& operator<< (std::ostream &os, const std::tm &t)
{
    std::stringstream strm;

    strm << "Daylight Savings = "   << t.tm_isdst
         << "\nDay of year      = " << t.tm_yday
         << "\nDay of week      = " << t.tm_wday
         << "\nYear             = " << t.tm_year
         << "\nMonth            = " << t.tm_mon
         << "\nDay of month     = " << t.tm_mday
         << "\nHour             = " << t.tm_hour
         << "\nMinute           = " << t.tm_min
         << "\nSecond           = " << t.tm_sec
         << '\n';

    // guard for thread safety and output synchronization
    const std::ostream::sentry guard (os);

    if (guard)
        os.rdbuf ()->sputn (strm.str ().c_str (), strm.str ().size ());
    else
        os.setstate (os.failbit);

    return os;
}


int main ()
{
    typedef std::istreambuf_iterator<char, std::char_traits<char> > Iter;

    // time struct to parse date into
    static std::tm timeb;  // zero initialized

    // Unused, required by time_get
    std::ios_base::iostate state;

    // Stream object to read from
    std::istringstream ins ("");

    // Iterators into the stream object
    Iter begin (ins);
    Iter end;

    // Get a reference to the time_get facet in locale loc.
    const std::time_get<char, Iter> &tg =
        std::use_facet<std::time_get<char, Iter> >(std::locale ("C"));

    // Display time_base::dateorder value.
    std::cout << "time_base::dateorder == " << tg.date_order () << ".\n";
  
    // Insert date string into stream.
    ins.str ("04/07/69");

    // get_date from the stream and output tm contents.
    tg.get_date (begin, end, ins, state, &timeb);
    std::cout << "Date: Apr 7 1969\n" << timeb << std::endl;

    return 0;
}

Stack Trace:

>	msvcr80d.dll!_mbstowcs_l_helper(wchar_t * pwcs=0x008e2b78, const char * s=0x008e6008, unsigned int n=1812, localeinfo_struct * plocinfo=0x0012f740)  Line 71	C++
 	msvcr80d.dll!_mbstowcs_s_l(unsigned int * pConvertedChars=0x0012f7b0, wchar_t * pwcs=0x008e2b78, unsigned int sizeInWords=1812, const char * s=0x008e6008, unsigned int n=4294967295, localeinfo_struct * plocinfo=0x0012f7d4)  Line 259 + 0x30 bytes	C++
 	msvcr80d.dll!_wcsftime_l_stat(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858, localeinfo_struct * plocinfo=0x0012f7d4)  Line 101 + 0x32 bytes	C++
 	msvcr80d.dll!_wcsftime_l(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858, localeinfo_struct * plocinfo=0x00000000)  Line 152 + 0x1e bytes	C++
 	msvcr80d.dll!wcsftime(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858)  Line 162 + 0x17 bytes	C++
 	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int flags=64, unsigned int inx=0)  Line 695 + 0x28 bytes	C++
 	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int flags=64, const void * * names=0x0012fc40, unsigned int * sizes=0x0012faa8)  Line 1115 + 0x11 bytes	C++
 	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int * data=0x0012fa4c, tm * tmb=0x0012fa78, int * * pmem=0x0012fa6c, const void * * names=0x0012fc40, unsigned int * sizes=0x0012faa8)  Line 1452 + 0x23 bytes	C++
 	time_get.exe!std::time_get<char,std::istreambuf_iterator<char,std::char_traits<char> > >::do_get(std::istreambuf_iterator<char,std::char_traits<char> > __it={...}, std::istreambuf_iterator<char,std::char_traits<char> > __end={...}, std::ios_base & __fl={...}, __rw::__rw_iostate & __err=-858993460, tm * __tmb=0x00492518, char __fmt='x', char __modifier=0)  Line 175 + 0x2c bytes	C++
 	time_get.exe!std::time_get<char,std::istreambuf_iterator<

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


[jira] Updated: (STDCXX-93) [MSVC 8.0] time_get crashes when calling get_date

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-93?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Sebor updated STDCXX-93:
-------------------------------

             Severity: Runtime Error
    Affects Version/s: 4.1.2
                       4.1.3
                       4.1.4

> [MSVC 8.0] time_get crashes when calling get_date
> -------------------------------------------------
>
>                 Key: STDCXX-93
>                 URL: https://issues.apache.org/jira/browse/STDCXX-93
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Examples
>    Affects Versions: 4.1.2, 4.1.3, 4.1.4
>         Environment: Visual C++ 8.0
>            Reporter: Vikas Mehta
>            Assignee: Martin Sebor
>             Fix For: 4.2
>
>
> Test case:
> // Following code snippet is taken from examples\manual\time_get.cpp
> // NOTE: A SunPro bug requires time.h preceed locale. PR #26255
> #include <ctime>      // for struct tm
> #include <locale>     // for locale, time_get
> #include <sstream>    // for stringstream
> #include <iostream>   // for cout, endl
> // Print out a tm struct value in one atomic operation
> std::ostream& operator<< (std::ostream &os, const std::tm &t)
> {
>     std::stringstream strm;
>     strm << "Daylight Savings = "   << t.tm_isdst
>          << "\nDay of year      = " << t.tm_yday
>          << "\nDay of week      = " << t.tm_wday
>          << "\nYear             = " << t.tm_year
>          << "\nMonth            = " << t.tm_mon
>          << "\nDay of month     = " << t.tm_mday
>          << "\nHour             = " << t.tm_hour
>          << "\nMinute           = " << t.tm_min
>          << "\nSecond           = " << t.tm_sec
>          << '\n';
>     // guard for thread safety and output synchronization
>     const std::ostream::sentry guard (os);
>     if (guard)
>         os.rdbuf ()->sputn (strm.str ().c_str (), strm.str ().size ());
>     else
>         os.setstate (os.failbit);
>     return os;
> }
> int main ()
> {
>     typedef std::istreambuf_iterator<char, std::char_traits<char> > Iter;
>     // time struct to parse date into
>     static std::tm timeb;  // zero initialized
>     // Unused, required by time_get
>     std::ios_base::iostate state;
>     // Stream object to read from
>     std::istringstream ins ("");
>     // Iterators into the stream object
>     Iter begin (ins);
>     Iter end;
>     // Get a reference to the time_get facet in locale loc.
>     const std::time_get<char, Iter> &tg =
>         std::use_facet<std::time_get<char, Iter> >(std::locale ("C"));
>     // Display time_base::dateorder value.
>     std::cout << "time_base::dateorder == " << tg.date_order () << ".\n";
>   
>     // Insert date string into stream.
>     ins.str ("04/07/69");
>     // get_date from the stream and output tm contents.
>     tg.get_date (begin, end, ins, state, &timeb);
>     std::cout << "Date: Apr 7 1969\n" << timeb << std::endl;
>     return 0;
> }
> Stack Trace:
> >	msvcr80d.dll!_mbstowcs_l_helper(wchar_t * pwcs=0x008e2b78, const char * s=0x008e6008, unsigned int n=1812, localeinfo_struct * plocinfo=0x0012f740)  Line 71	C++
>  	msvcr80d.dll!_mbstowcs_s_l(unsigned int * pConvertedChars=0x0012f7b0, wchar_t * pwcs=0x008e2b78, unsigned int sizeInWords=1812, const char * s=0x008e6008, unsigned int n=4294967295, localeinfo_struct * plocinfo=0x0012f7d4)  Line 259 + 0x30 bytes	C++
>  	msvcr80d.dll!_wcsftime_l_stat(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858, localeinfo_struct * plocinfo=0x0012f7d4)  Line 101 + 0x32 bytes	C++
>  	msvcr80d.dll!_wcsftime_l(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858, localeinfo_struct * plocinfo=0x00000000)  Line 152 + 0x1e bytes	C++
>  	msvcr80d.dll!wcsftime(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858)  Line 162 + 0x17 bytes	C++
>  	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int flags=64, unsigned int inx=0)  Line 695 + 0x28 bytes	C++
>  	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int flags=64, const void * * names=0x0012fc40, unsigned int * sizes=0x0012faa8)  Line 1115 + 0x11 bytes	C++
>  	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int * data=0x0012fa4c, tm * tmb=0x0012fa78, int * * pmem=0x0012fa6c, const void * * names=0x0012fc40, unsigned int * sizes=0x0012faa8)  Line 1452 + 0x23 bytes	C++
>  	time_get.exe!std::time_get<char,std::istreambuf_iterator<char,std::char_traits<char> > >::do_get(std::istreambuf_iterator<char,std::char_traits<char> > __it={...}, std::istreambuf_iterator<char,std::char_traits<char> > __end={...}, std::ios_base & __fl={...}, __rw::__rw_iostate & __err=-858993460, tm * __tmb=0x00492518, char __fmt='x', char __modifier=0)  Line 175 + 0x2c bytes	C++
>  	time_get.exe!std::time_get<char,std::istreambuf_iterator<

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (STDCXX-93) time_get crashes when calling get_date ( Visual C++ 8.0 )

Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/STDCXX-93?page=all ]

Farid Zaripov resolved STDCXX-93.
---------------------------------

    Fix Version/s: 4.2
       Resolution: Fixed

Fixed

> time_get crashes when calling get_date ( Visual C++ 8.0 )
> ---------------------------------------------------------
>
>                 Key: STDCXX-93
>                 URL: http://issues.apache.org/jira/browse/STDCXX-93
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Examples
>         Environment: Visual C++ 8.0
>            Reporter: Vikas Mehta
>         Assigned To: Martin Sebor
>             Fix For: 4.2
>
>
> Test case:
> // Following code snippet is taken from examples\manual\time_get.cpp
> // NOTE: A SunPro bug requires time.h preceed locale. PR #26255
> #include <ctime>      // for struct tm
> #include <locale>     // for locale, time_get
> #include <sstream>    // for stringstream
> #include <iostream>   // for cout, endl
> // Print out a tm struct value in one atomic operation
> std::ostream& operator<< (std::ostream &os, const std::tm &t)
> {
>     std::stringstream strm;
>     strm << "Daylight Savings = "   << t.tm_isdst
>          << "\nDay of year      = " << t.tm_yday
>          << "\nDay of week      = " << t.tm_wday
>          << "\nYear             = " << t.tm_year
>          << "\nMonth            = " << t.tm_mon
>          << "\nDay of month     = " << t.tm_mday
>          << "\nHour             = " << t.tm_hour
>          << "\nMinute           = " << t.tm_min
>          << "\nSecond           = " << t.tm_sec
>          << '\n';
>     // guard for thread safety and output synchronization
>     const std::ostream::sentry guard (os);
>     if (guard)
>         os.rdbuf ()->sputn (strm.str ().c_str (), strm.str ().size ());
>     else
>         os.setstate (os.failbit);
>     return os;
> }
> int main ()
> {
>     typedef std::istreambuf_iterator<char, std::char_traits<char> > Iter;
>     // time struct to parse date into
>     static std::tm timeb;  // zero initialized
>     // Unused, required by time_get
>     std::ios_base::iostate state;
>     // Stream object to read from
>     std::istringstream ins ("");
>     // Iterators into the stream object
>     Iter begin (ins);
>     Iter end;
>     // Get a reference to the time_get facet in locale loc.
>     const std::time_get<char, Iter> &tg =
>         std::use_facet<std::time_get<char, Iter> >(std::locale ("C"));
>     // Display time_base::dateorder value.
>     std::cout << "time_base::dateorder == " << tg.date_order () << ".\n";
>   
>     // Insert date string into stream.
>     ins.str ("04/07/69");
>     // get_date from the stream and output tm contents.
>     tg.get_date (begin, end, ins, state, &timeb);
>     std::cout << "Date: Apr 7 1969\n" << timeb << std::endl;
>     return 0;
> }
> Stack Trace:
> >	msvcr80d.dll!_mbstowcs_l_helper(wchar_t * pwcs=0x008e2b78, const char * s=0x008e6008, unsigned int n=1812, localeinfo_struct * plocinfo=0x0012f740)  Line 71	C++
>  	msvcr80d.dll!_mbstowcs_s_l(unsigned int * pConvertedChars=0x0012f7b0, wchar_t * pwcs=0x008e2b78, unsigned int sizeInWords=1812, const char * s=0x008e6008, unsigned int n=4294967295, localeinfo_struct * plocinfo=0x0012f7d4)  Line 259 + 0x30 bytes	C++
>  	msvcr80d.dll!_wcsftime_l_stat(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858, localeinfo_struct * plocinfo=0x0012f7d4)  Line 101 + 0x32 bytes	C++
>  	msvcr80d.dll!_wcsftime_l(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858, localeinfo_struct * plocinfo=0x00000000)  Line 152 + 0x1e bytes	C++
>  	msvcr80d.dll!wcsftime(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858)  Line 162 + 0x17 bytes	C++
>  	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int flags=64, unsigned int inx=0)  Line 695 + 0x28 bytes	C++
>  	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int flags=64, const void * * names=0x0012fc40, unsigned int * sizes=0x0012faa8)  Line 1115 + 0x11 bytes	C++
>  	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int * data=0x0012fa4c, tm * tmb=0x0012fa78, int * * pmem=0x0012fa6c, const void * * names=0x0012fc40, unsigned int * sizes=0x0012faa8)  Line 1452 + 0x23 bytes	C++
>  	time_get.exe!std::time_get<char,std::istreambuf_iterator<char,std::char_traits<char> > >::do_get(std::istreambuf_iterator<char,std::char_traits<char> > __it={...}, std::istreambuf_iterator<char,std::char_traits<char> > __end={...}, std::ios_base & __fl={...}, __rw::__rw_iostate & __err=-858993460, tm * __tmb=0x00492518, char __fmt='x', char __modifier=0)  Line 175 + 0x2c bytes	C++
>  	time_get.exe!std::time_get<char,std::istreambuf_iterator<

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

        

[jira] Commented: (STDCXX-93) time_get crashes when calling get_date ( Visual C++ 8.0 )

Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/STDCXX-93?page=comments#action_12439828 ] 
            
Farid Zaripov commented on STDCXX-93:
-------------------------------------

src/time_put.cpp, line 959:
---------------------
    size  = mbstowcs (pwbuf, str, _RWSTD_SIZE_MAX);
---------------------

  Third parameter of mbstowcs() call is _RWSTD_SIZE_MAX, but mbstowcs() requires that this parameter should be <= INT_MAX:
http://msdn2.microsoft.com/en-us/library/k1f9b8cy.aspx
---------------------
size_t mbstowcs(wchar_t *wcstr, const char *mbstr, size_t count);
[...]
If the mbstr argument is NULL, or if count is > INT_MAX, the invalid parameter handler is invoked, as described in Parameter Validation . If execution is allowed to continue, errno is set to EINVAL and the function returns -1.
---------------------

  Possible solution is replace _RWSTD_SIZE_MAX to _RWSTD_INT_MAX in all calls of the mbstowcs().

> time_get crashes when calling get_date ( Visual C++ 8.0 )
> ---------------------------------------------------------
>
>                 Key: STDCXX-93
>                 URL: http://issues.apache.org/jira/browse/STDCXX-93
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Examples
>         Environment: Visual C++ 8.0
>            Reporter: Vikas Mehta
>         Assigned To: Martin Sebor
>
> Test case:
> // Following code snippet is taken from examples\manual\time_get.cpp
> // NOTE: A SunPro bug requires time.h preceed locale. PR #26255
> #include <ctime>      // for struct tm
> #include <locale>     // for locale, time_get
> #include <sstream>    // for stringstream
> #include <iostream>   // for cout, endl
> // Print out a tm struct value in one atomic operation
> std::ostream& operator<< (std::ostream &os, const std::tm &t)
> {
>     std::stringstream strm;
>     strm << "Daylight Savings = "   << t.tm_isdst
>          << "\nDay of year      = " << t.tm_yday
>          << "\nDay of week      = " << t.tm_wday
>          << "\nYear             = " << t.tm_year
>          << "\nMonth            = " << t.tm_mon
>          << "\nDay of month     = " << t.tm_mday
>          << "\nHour             = " << t.tm_hour
>          << "\nMinute           = " << t.tm_min
>          << "\nSecond           = " << t.tm_sec
>          << '\n';
>     // guard for thread safety and output synchronization
>     const std::ostream::sentry guard (os);
>     if (guard)
>         os.rdbuf ()->sputn (strm.str ().c_str (), strm.str ().size ());
>     else
>         os.setstate (os.failbit);
>     return os;
> }
> int main ()
> {
>     typedef std::istreambuf_iterator<char, std::char_traits<char> > Iter;
>     // time struct to parse date into
>     static std::tm timeb;  // zero initialized
>     // Unused, required by time_get
>     std::ios_base::iostate state;
>     // Stream object to read from
>     std::istringstream ins ("");
>     // Iterators into the stream object
>     Iter begin (ins);
>     Iter end;
>     // Get a reference to the time_get facet in locale loc.
>     const std::time_get<char, Iter> &tg =
>         std::use_facet<std::time_get<char, Iter> >(std::locale ("C"));
>     // Display time_base::dateorder value.
>     std::cout << "time_base::dateorder == " << tg.date_order () << ".\n";
>   
>     // Insert date string into stream.
>     ins.str ("04/07/69");
>     // get_date from the stream and output tm contents.
>     tg.get_date (begin, end, ins, state, &timeb);
>     std::cout << "Date: Apr 7 1969\n" << timeb << std::endl;
>     return 0;
> }
> Stack Trace:
> >	msvcr80d.dll!_mbstowcs_l_helper(wchar_t * pwcs=0x008e2b78, const char * s=0x008e6008, unsigned int n=1812, localeinfo_struct * plocinfo=0x0012f740)  Line 71	C++
>  	msvcr80d.dll!_mbstowcs_s_l(unsigned int * pConvertedChars=0x0012f7b0, wchar_t * pwcs=0x008e2b78, unsigned int sizeInWords=1812, const char * s=0x008e6008, unsigned int n=4294967295, localeinfo_struct * plocinfo=0x0012f7d4)  Line 259 + 0x30 bytes	C++
>  	msvcr80d.dll!_wcsftime_l_stat(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858, localeinfo_struct * plocinfo=0x0012f7d4)  Line 101 + 0x32 bytes	C++
>  	msvcr80d.dll!_wcsftime_l(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858, localeinfo_struct * plocinfo=0x00000000)  Line 152 + 0x1e bytes	C++
>  	msvcr80d.dll!wcsftime(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858)  Line 162 + 0x17 bytes	C++
>  	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int flags=64, unsigned int inx=0)  Line 695 + 0x28 bytes	C++
>  	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int flags=64, const void * * names=0x0012fc40, unsigned int * sizes=0x0012faa8)  Line 1115 + 0x11 bytes	C++
>  	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int * data=0x0012fa4c, tm * tmb=0x0012fa78, int * * pmem=0x0012fa6c, const void * * names=0x0012fc40, unsigned int * sizes=0x0012faa8)  Line 1452 + 0x23 bytes	C++
>  	time_get.exe!std::time_get<char,std::istreambuf_iterator<char,std::char_traits<char> > >::do_get(std::istreambuf_iterator<char,std::char_traits<char> > __it={...}, std::istreambuf_iterator<char,std::char_traits<char> > __end={...}, std::ios_base & __fl={...}, __rw::__rw_iostate & __err=-858993460, tm * __tmb=0x00492518, char __fmt='x', char __modifier=0)  Line 175 + 0x2c bytes	C++
>  	time_get.exe!std::time_get<char,std::istreambuf_iterator<

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

        

[jira] Commented: (STDCXX-93) time_get crashes when calling get_date ( Visual C++ 8.0 )

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/STDCXX-93?page=comments#action_12361705 ] 

Martin Sebor commented on STDCXX-93:
------------------------------------

I've stepped through the code in the debugger and from what I've seen it looks like a bug in the MSVC 8.0 implementation of wcsftime(), although my stack trace is a bit different (see below). The function _wcsftime_l_stat() allocates memory by calling _calloca() and later aborts in a call to _freea() deallocating the same block of memory.

>       time_get.exe!_freea(void * _Memory=0x008859c0)  Line 258 + 0x24 bytes  C++
        time_get.exe!_wcsftime_l_stat(wchar_t * wstring=0x00885192, unsigned int maxsize=2034, const wchar_t * wformat=0x004b5eb4, const tm * timeptr=0x0012f8b0, localeinfo_struct * plocinfo=0x0012f83c)  Line 127 + 0x9 bytes        C++
        time_get.exe!_wcsftime_l(wchar_t * wstring=0x00885192, unsigned int maxsize=2034, const wchar_t * wformat=0x004b5eb4, const tm * timeptr=0x0012f8b0, localeinfo_struct * plocinfo=0x00000000)  Line 152 + 0x1e bytes    C++
        time_get.exe!wcsftime(wchar_t * wstring=0x00885192, unsigned int maxsize=2034, const wchar_t * wformat=0x004b5eb4, const tm * timeptr=0x0012f8b0)  Line 162 + 0x17 bytes        C++
        time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x004ed678, int flags=64, unsigned int inx=0)  Line 700 + 0x22 bytes      C++
        time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x004ed678, int flags=64, const void * * names=0x0012faa8, unsigned int * sizes=0x0012fc50)  Line 1120 + 0x11 bytes       C++
        time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x004ed678, int * data=0x0012fc3c, tm * tmb=0x0012fa84, int * * pmem=0x0012fde4, const void * * names=0x0012faa8, unsigned int * sizes=0x0012fc50)  Line 1457 + 0x23 bytes        C++
        time_get.exe!std::time_get<char,std::istreambuf_iterator<char,std::char_traits<char> > >::do_get(std::istreambuf_iterator<char,std::char_traits<char> > __it={...}, std::istreambuf_iterator<char,std::char_traits<char> > __end={...}, std::ios_base & __fl={...}, __rw::__rw_iostate & __err=1244868, tm * __tmb=0x004eb580, char __fmt='x', char __modifier=0)  Line 175 + 0x29 bytes        C++
        time_get.exe!std::time_get<char,std::istreambuf_iterator<char,std::char_traits<char> > >::do_get_date(std::istreambuf_iterator<char,std::char_traits<char> > __it={...}, std::istreambuf_iterator<char,std::char_traits<char> > __end={...}, std::ios_base & __fl={...}, __rw::__rw_iostate & __err=1244868, tm * __tmb=0x004eb580)  Line 144 + 0x29 bytes      C++
        time_get.exe!std::time_get<char,std::istreambuf_iterator<char,std::char_traits<char> > >::get_date(std::istreambuf_iterator<char,std::char_traits<char> > __start={...}, std::istreambuf_iterator<char,std::char_traits<char> > __end={...}, std::ios_base & __flags={...}, __rw::__rw_iostate & __err=1244868, tm * __time=0x004eb580)  Line 85 + 0x25 bytes   C++
        time_get.exe!main()  Line 86    C++

> time_get crashes when calling get_date ( Visual C++ 8.0 )
> ---------------------------------------------------------
>
>          Key: STDCXX-93
>          URL: http://issues.apache.org/jira/browse/STDCXX-93
>      Project: STDCXX
>         Type: Bug
>   Components: Examples
>  Environment: Visual C++ 8.0
>     Reporter: Vikas Mehta
>     Assignee: Martin Sebor

>
> Test case:
> // Following code snippet is taken from examples\manual\time_get.cpp
> // NOTE: A SunPro bug requires time.h preceed locale. PR #26255
> #include <ctime>      // for struct tm
> #include <locale>     // for locale, time_get
> #include <sstream>    // for stringstream
> #include <iostream>   // for cout, endl
> // Print out a tm struct value in one atomic operation
> std::ostream& operator<< (std::ostream &os, const std::tm &t)
> {
>     std::stringstream strm;
>     strm << "Daylight Savings = "   << t.tm_isdst
>          << "\nDay of year      = " << t.tm_yday
>          << "\nDay of week      = " << t.tm_wday
>          << "\nYear             = " << t.tm_year
>          << "\nMonth            = " << t.tm_mon
>          << "\nDay of month     = " << t.tm_mday
>          << "\nHour             = " << t.tm_hour
>          << "\nMinute           = " << t.tm_min
>          << "\nSecond           = " << t.tm_sec
>          << '\n';
>     // guard for thread safety and output synchronization
>     const std::ostream::sentry guard (os);
>     if (guard)
>         os.rdbuf ()->sputn (strm.str ().c_str (), strm.str ().size ());
>     else
>         os.setstate (os.failbit);
>     return os;
> }
> int main ()
> {
>     typedef std::istreambuf_iterator<char, std::char_traits<char> > Iter;
>     // time struct to parse date into
>     static std::tm timeb;  // zero initialized
>     // Unused, required by time_get
>     std::ios_base::iostate state;
>     // Stream object to read from
>     std::istringstream ins ("");
>     // Iterators into the stream object
>     Iter begin (ins);
>     Iter end;
>     // Get a reference to the time_get facet in locale loc.
>     const std::time_get<char, Iter> &tg =
>         std::use_facet<std::time_get<char, Iter> >(std::locale ("C"));
>     // Display time_base::dateorder value.
>     std::cout << "time_base::dateorder == " << tg.date_order () << ".\n";
>   
>     // Insert date string into stream.
>     ins.str ("04/07/69");
>     // get_date from the stream and output tm contents.
>     tg.get_date (begin, end, ins, state, &timeb);
>     std::cout << "Date: Apr 7 1969\n" << timeb << std::endl;
>     return 0;
> }
> Stack Trace:
> >	msvcr80d.dll!_mbstowcs_l_helper(wchar_t * pwcs=0x008e2b78, const char * s=0x008e6008, unsigned int n=1812, localeinfo_struct * plocinfo=0x0012f740)  Line 71	C++
>  	msvcr80d.dll!_mbstowcs_s_l(unsigned int * pConvertedChars=0x0012f7b0, wchar_t * pwcs=0x008e2b78, unsigned int sizeInWords=1812, const char * s=0x008e6008, unsigned int n=4294967295, localeinfo_struct * plocinfo=0x0012f7d4)  Line 259 + 0x30 bytes	C++
>  	msvcr80d.dll!_wcsftime_l_stat(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858, localeinfo_struct * plocinfo=0x0012f7d4)  Line 101 + 0x32 bytes	C++
>  	msvcr80d.dll!_wcsftime_l(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858, localeinfo_struct * plocinfo=0x00000000)  Line 152 + 0x1e bytes	C++
>  	msvcr80d.dll!wcsftime(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858)  Line 162 + 0x17 bytes	C++
>  	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int flags=64, unsigned int inx=0)  Line 695 + 0x28 bytes	C++
>  	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int flags=64, const void * * names=0x0012fc40, unsigned int * sizes=0x0012faa8)  Line 1115 + 0x11 bytes	C++
>  	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int * data=0x0012fa4c, tm * tmb=0x0012fa78, int * * pmem=0x0012fa6c, const void * * names=0x0012fc40, unsigned int * sizes=0x0012faa8)  Line 1452 + 0x23 bytes	C++
>  	time_get.exe!std::time_get<char,std::istreambuf_iterator<char,std::char_traits<char> > >::do_get(std::istreambuf_iterator<char,std::char_traits<char> > __it={...}, std::istreambuf_iterator<char,std::char_traits<char> > __end={...}, std::ios_base & __fl={...}, __rw::__rw_iostate & __err=-858993460, tm * __tmb=0x00492518, char __fmt='x', char __modifier=0)  Line 175 + 0x2c bytes	C++
>  	time_get.exe!std::time_get<char,std::istreambuf_iterator<

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


[jira] Commented: (STDCXX-93) time_get crashes when calling get_date ( Visual C++ 8.0 )

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/STDCXX-93?page=comments#action_12439942 ] 
            
Martin Sebor commented on STDCXX-93:
------------------------------------

This is yet another gratuitous conformance violation in the MSVC runtime library. I opened an issue for it (although I doubt they'll fix it, they
treat the C/C++ standards as just a bunch of suggestions): https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=218258 

> time_get crashes when calling get_date ( Visual C++ 8.0 )
> ---------------------------------------------------------
>
>                 Key: STDCXX-93
>                 URL: http://issues.apache.org/jira/browse/STDCXX-93
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Examples
>         Environment: Visual C++ 8.0
>            Reporter: Vikas Mehta
>         Assigned To: Martin Sebor
>
> Test case:
> // Following code snippet is taken from examples\manual\time_get.cpp
> // NOTE: A SunPro bug requires time.h preceed locale. PR #26255
> #include <ctime>      // for struct tm
> #include <locale>     // for locale, time_get
> #include <sstream>    // for stringstream
> #include <iostream>   // for cout, endl
> // Print out a tm struct value in one atomic operation
> std::ostream& operator<< (std::ostream &os, const std::tm &t)
> {
>     std::stringstream strm;
>     strm << "Daylight Savings = "   << t.tm_isdst
>          << "\nDay of year      = " << t.tm_yday
>          << "\nDay of week      = " << t.tm_wday
>          << "\nYear             = " << t.tm_year
>          << "\nMonth            = " << t.tm_mon
>          << "\nDay of month     = " << t.tm_mday
>          << "\nHour             = " << t.tm_hour
>          << "\nMinute           = " << t.tm_min
>          << "\nSecond           = " << t.tm_sec
>          << '\n';
>     // guard for thread safety and output synchronization
>     const std::ostream::sentry guard (os);
>     if (guard)
>         os.rdbuf ()->sputn (strm.str ().c_str (), strm.str ().size ());
>     else
>         os.setstate (os.failbit);
>     return os;
> }
> int main ()
> {
>     typedef std::istreambuf_iterator<char, std::char_traits<char> > Iter;
>     // time struct to parse date into
>     static std::tm timeb;  // zero initialized
>     // Unused, required by time_get
>     std::ios_base::iostate state;
>     // Stream object to read from
>     std::istringstream ins ("");
>     // Iterators into the stream object
>     Iter begin (ins);
>     Iter end;
>     // Get a reference to the time_get facet in locale loc.
>     const std::time_get<char, Iter> &tg =
>         std::use_facet<std::time_get<char, Iter> >(std::locale ("C"));
>     // Display time_base::dateorder value.
>     std::cout << "time_base::dateorder == " << tg.date_order () << ".\n";
>   
>     // Insert date string into stream.
>     ins.str ("04/07/69");
>     // get_date from the stream and output tm contents.
>     tg.get_date (begin, end, ins, state, &timeb);
>     std::cout << "Date: Apr 7 1969\n" << timeb << std::endl;
>     return 0;
> }
> Stack Trace:
> >	msvcr80d.dll!_mbstowcs_l_helper(wchar_t * pwcs=0x008e2b78, const char * s=0x008e6008, unsigned int n=1812, localeinfo_struct * plocinfo=0x0012f740)  Line 71	C++
>  	msvcr80d.dll!_mbstowcs_s_l(unsigned int * pConvertedChars=0x0012f7b0, wchar_t * pwcs=0x008e2b78, unsigned int sizeInWords=1812, const char * s=0x008e6008, unsigned int n=4294967295, localeinfo_struct * plocinfo=0x0012f7d4)  Line 259 + 0x30 bytes	C++
>  	msvcr80d.dll!_wcsftime_l_stat(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858, localeinfo_struct * plocinfo=0x0012f7d4)  Line 101 + 0x32 bytes	C++
>  	msvcr80d.dll!_wcsftime_l(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858, localeinfo_struct * plocinfo=0x00000000)  Line 152 + 0x1e bytes	C++
>  	msvcr80d.dll!wcsftime(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858)  Line 162 + 0x17 bytes	C++
>  	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int flags=64, unsigned int inx=0)  Line 695 + 0x28 bytes	C++
>  	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int flags=64, const void * * names=0x0012fc40, unsigned int * sizes=0x0012faa8)  Line 1115 + 0x11 bytes	C++
>  	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int * data=0x0012fa4c, tm * tmb=0x0012fa78, int * * pmem=0x0012fa6c, const void * * names=0x0012fc40, unsigned int * sizes=0x0012faa8)  Line 1452 + 0x23 bytes	C++
>  	time_get.exe!std::time_get<char,std::istreambuf_iterator<char,std::char_traits<char> > >::do_get(std::istreambuf_iterator<char,std::char_traits<char> > __it={...}, std::istreambuf_iterator<char,std::char_traits<char> > __end={...}, std::ios_base & __fl={...}, __rw::__rw_iostate & __err=-858993460, tm * __tmb=0x00492518, char __fmt='x', char __modifier=0)  Line 175 + 0x2c bytes	C++
>  	time_get.exe!std::time_get<char,std::istreambuf_iterator<

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

        

[jira] Closed: (STDCXX-93) [MSVC 8.0] time_get crashes when calling get_date

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-93?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Sebor closed STDCXX-93.
------------------------------


The example program runs fine in nightly builds with MSVC 8.0.

> [MSVC 8.0] time_get crashes when calling get_date
> -------------------------------------------------
>
>                 Key: STDCXX-93
>                 URL: https://issues.apache.org/jira/browse/STDCXX-93
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Examples
>         Environment: Visual C++ 8.0
>            Reporter: Vikas Mehta
>            Assignee: Martin Sebor
>             Fix For: 4.2
>
>
> Test case:
> // Following code snippet is taken from examples\manual\time_get.cpp
> // NOTE: A SunPro bug requires time.h preceed locale. PR #26255
> #include <ctime>      // for struct tm
> #include <locale>     // for locale, time_get
> #include <sstream>    // for stringstream
> #include <iostream>   // for cout, endl
> // Print out a tm struct value in one atomic operation
> std::ostream& operator<< (std::ostream &os, const std::tm &t)
> {
>     std::stringstream strm;
>     strm << "Daylight Savings = "   << t.tm_isdst
>          << "\nDay of year      = " << t.tm_yday
>          << "\nDay of week      = " << t.tm_wday
>          << "\nYear             = " << t.tm_year
>          << "\nMonth            = " << t.tm_mon
>          << "\nDay of month     = " << t.tm_mday
>          << "\nHour             = " << t.tm_hour
>          << "\nMinute           = " << t.tm_min
>          << "\nSecond           = " << t.tm_sec
>          << '\n';
>     // guard for thread safety and output synchronization
>     const std::ostream::sentry guard (os);
>     if (guard)
>         os.rdbuf ()->sputn (strm.str ().c_str (), strm.str ().size ());
>     else
>         os.setstate (os.failbit);
>     return os;
> }
> int main ()
> {
>     typedef std::istreambuf_iterator<char, std::char_traits<char> > Iter;
>     // time struct to parse date into
>     static std::tm timeb;  // zero initialized
>     // Unused, required by time_get
>     std::ios_base::iostate state;
>     // Stream object to read from
>     std::istringstream ins ("");
>     // Iterators into the stream object
>     Iter begin (ins);
>     Iter end;
>     // Get a reference to the time_get facet in locale loc.
>     const std::time_get<char, Iter> &tg =
>         std::use_facet<std::time_get<char, Iter> >(std::locale ("C"));
>     // Display time_base::dateorder value.
>     std::cout << "time_base::dateorder == " << tg.date_order () << ".\n";
>   
>     // Insert date string into stream.
>     ins.str ("04/07/69");
>     // get_date from the stream and output tm contents.
>     tg.get_date (begin, end, ins, state, &timeb);
>     std::cout << "Date: Apr 7 1969\n" << timeb << std::endl;
>     return 0;
> }
> Stack Trace:
> >	msvcr80d.dll!_mbstowcs_l_helper(wchar_t * pwcs=0x008e2b78, const char * s=0x008e6008, unsigned int n=1812, localeinfo_struct * plocinfo=0x0012f740)  Line 71	C++
>  	msvcr80d.dll!_mbstowcs_s_l(unsigned int * pConvertedChars=0x0012f7b0, wchar_t * pwcs=0x008e2b78, unsigned int sizeInWords=1812, const char * s=0x008e6008, unsigned int n=4294967295, localeinfo_struct * plocinfo=0x0012f7d4)  Line 259 + 0x30 bytes	C++
>  	msvcr80d.dll!_wcsftime_l_stat(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858, localeinfo_struct * plocinfo=0x0012f7d4)  Line 101 + 0x32 bytes	C++
>  	msvcr80d.dll!_wcsftime_l(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858, localeinfo_struct * plocinfo=0x00000000)  Line 152 + 0x1e bytes	C++
>  	msvcr80d.dll!wcsftime(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858)  Line 162 + 0x17 bytes	C++
>  	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int flags=64, unsigned int inx=0)  Line 695 + 0x28 bytes	C++
>  	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int flags=64, const void * * names=0x0012fc40, unsigned int * sizes=0x0012faa8)  Line 1115 + 0x11 bytes	C++
>  	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int * data=0x0012fa4c, tm * tmb=0x0012fa78, int * * pmem=0x0012fa6c, const void * * names=0x0012fc40, unsigned int * sizes=0x0012faa8)  Line 1452 + 0x23 bytes	C++
>  	time_get.exe!std::time_get<char,std::istreambuf_iterator<char,std::char_traits<char> > >::do_get(std::istreambuf_iterator<char,std::char_traits<char> > __it={...}, std::istreambuf_iterator<char,std::char_traits<char> > __end={...}, std::ios_base & __fl={...}, __rw::__rw_iostate & __err=-858993460, tm * __tmb=0x00492518, char __fmt='x', char __modifier=0)  Line 175 + 0x2c bytes	C++
>  	time_get.exe!std::time_get<char,std::istreambuf_iterator<

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (STDCXX-93) time_get crashes when calling get_date ( Visual C++ 8.0 )

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/STDCXX-93?page=all ]

Martin Sebor reassigned STDCXX-93:
----------------------------------

    Assign To: Martin Sebor

> time_get crashes when calling get_date ( Visual C++ 8.0 )
> ---------------------------------------------------------
>
>          Key: STDCXX-93
>          URL: http://issues.apache.org/jira/browse/STDCXX-93
>      Project: STDCXX
>         Type: Bug
>   Components: Examples
>  Environment: Visual C++ 8.0
>     Reporter: Vikas Mehta
>     Assignee: Martin Sebor

>
> Test case:
> // Following code snippet is taken from examples\manual\time_get.cpp
> // NOTE: A SunPro bug requires time.h preceed locale. PR #26255
> #include <ctime>      // for struct tm
> #include <locale>     // for locale, time_get
> #include <sstream>    // for stringstream
> #include <iostream>   // for cout, endl
> // Print out a tm struct value in one atomic operation
> std::ostream& operator<< (std::ostream &os, const std::tm &t)
> {
>     std::stringstream strm;
>     strm << "Daylight Savings = "   << t.tm_isdst
>          << "\nDay of year      = " << t.tm_yday
>          << "\nDay of week      = " << t.tm_wday
>          << "\nYear             = " << t.tm_year
>          << "\nMonth            = " << t.tm_mon
>          << "\nDay of month     = " << t.tm_mday
>          << "\nHour             = " << t.tm_hour
>          << "\nMinute           = " << t.tm_min
>          << "\nSecond           = " << t.tm_sec
>          << '\n';
>     // guard for thread safety and output synchronization
>     const std::ostream::sentry guard (os);
>     if (guard)
>         os.rdbuf ()->sputn (strm.str ().c_str (), strm.str ().size ());
>     else
>         os.setstate (os.failbit);
>     return os;
> }
> int main ()
> {
>     typedef std::istreambuf_iterator<char, std::char_traits<char> > Iter;
>     // time struct to parse date into
>     static std::tm timeb;  // zero initialized
>     // Unused, required by time_get
>     std::ios_base::iostate state;
>     // Stream object to read from
>     std::istringstream ins ("");
>     // Iterators into the stream object
>     Iter begin (ins);
>     Iter end;
>     // Get a reference to the time_get facet in locale loc.
>     const std::time_get<char, Iter> &tg =
>         std::use_facet<std::time_get<char, Iter> >(std::locale ("C"));
>     // Display time_base::dateorder value.
>     std::cout << "time_base::dateorder == " << tg.date_order () << ".\n";
>   
>     // Insert date string into stream.
>     ins.str ("04/07/69");
>     // get_date from the stream and output tm contents.
>     tg.get_date (begin, end, ins, state, &timeb);
>     std::cout << "Date: Apr 7 1969\n" << timeb << std::endl;
>     return 0;
> }
> Stack Trace:
> >	msvcr80d.dll!_mbstowcs_l_helper(wchar_t * pwcs=0x008e2b78, const char * s=0x008e6008, unsigned int n=1812, localeinfo_struct * plocinfo=0x0012f740)  Line 71	C++
>  	msvcr80d.dll!_mbstowcs_s_l(unsigned int * pConvertedChars=0x0012f7b0, wchar_t * pwcs=0x008e2b78, unsigned int sizeInWords=1812, const char * s=0x008e6008, unsigned int n=4294967295, localeinfo_struct * plocinfo=0x0012f7d4)  Line 259 + 0x30 bytes	C++
>  	msvcr80d.dll!_wcsftime_l_stat(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858, localeinfo_struct * plocinfo=0x0012f7d4)  Line 101 + 0x32 bytes	C++
>  	msvcr80d.dll!_wcsftime_l(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858, localeinfo_struct * plocinfo=0x00000000)  Line 152 + 0x1e bytes	C++
>  	msvcr80d.dll!wcsftime(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858)  Line 162 + 0x17 bytes	C++
>  	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int flags=64, unsigned int inx=0)  Line 695 + 0x28 bytes	C++
>  	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int flags=64, const void * * names=0x0012fc40, unsigned int * sizes=0x0012faa8)  Line 1115 + 0x11 bytes	C++
>  	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int * data=0x0012fa4c, tm * tmb=0x0012fa78, int * * pmem=0x0012fa6c, const void * * names=0x0012fc40, unsigned int * sizes=0x0012faa8)  Line 1452 + 0x23 bytes	C++
>  	time_get.exe!std::time_get<char,std::istreambuf_iterator<char,std::char_traits<char> > >::do_get(std::istreambuf_iterator<char,std::char_traits<char> > __it={...}, std::istreambuf_iterator<char,std::char_traits<char> > __end={...}, std::ios_base & __fl={...}, __rw::__rw_iostate & __err=-858993460, tm * __tmb=0x00492518, char __fmt='x', char __modifier=0)  Line 175 + 0x2c bytes	C++
>  	time_get.exe!std::time_get<char,std::istreambuf_iterator<

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


[jira] Updated: (STDCXX-93) [MSVC 8.0] time_get crashes when calling get_date

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-93?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Sebor updated STDCXX-93:
-------------------------------

    Summary: [MSVC 8.0] time_get crashes when calling get_date  (was: time_get crashes when calling get_date ( Visual C++ 8.0 ))

Tweaked Summary to conform to convention.

> [MSVC 8.0] time_get crashes when calling get_date
> -------------------------------------------------
>
>                 Key: STDCXX-93
>                 URL: https://issues.apache.org/jira/browse/STDCXX-93
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Examples
>         Environment: Visual C++ 8.0
>            Reporter: Vikas Mehta
>            Assignee: Martin Sebor
>             Fix For: 4.2
>
>
> Test case:
> // Following code snippet is taken from examples\manual\time_get.cpp
> // NOTE: A SunPro bug requires time.h preceed locale. PR #26255
> #include <ctime>      // for struct tm
> #include <locale>     // for locale, time_get
> #include <sstream>    // for stringstream
> #include <iostream>   // for cout, endl
> // Print out a tm struct value in one atomic operation
> std::ostream& operator<< (std::ostream &os, const std::tm &t)
> {
>     std::stringstream strm;
>     strm << "Daylight Savings = "   << t.tm_isdst
>          << "\nDay of year      = " << t.tm_yday
>          << "\nDay of week      = " << t.tm_wday
>          << "\nYear             = " << t.tm_year
>          << "\nMonth            = " << t.tm_mon
>          << "\nDay of month     = " << t.tm_mday
>          << "\nHour             = " << t.tm_hour
>          << "\nMinute           = " << t.tm_min
>          << "\nSecond           = " << t.tm_sec
>          << '\n';
>     // guard for thread safety and output synchronization
>     const std::ostream::sentry guard (os);
>     if (guard)
>         os.rdbuf ()->sputn (strm.str ().c_str (), strm.str ().size ());
>     else
>         os.setstate (os.failbit);
>     return os;
> }
> int main ()
> {
>     typedef std::istreambuf_iterator<char, std::char_traits<char> > Iter;
>     // time struct to parse date into
>     static std::tm timeb;  // zero initialized
>     // Unused, required by time_get
>     std::ios_base::iostate state;
>     // Stream object to read from
>     std::istringstream ins ("");
>     // Iterators into the stream object
>     Iter begin (ins);
>     Iter end;
>     // Get a reference to the time_get facet in locale loc.
>     const std::time_get<char, Iter> &tg =
>         std::use_facet<std::time_get<char, Iter> >(std::locale ("C"));
>     // Display time_base::dateorder value.
>     std::cout << "time_base::dateorder == " << tg.date_order () << ".\n";
>   
>     // Insert date string into stream.
>     ins.str ("04/07/69");
>     // get_date from the stream and output tm contents.
>     tg.get_date (begin, end, ins, state, &timeb);
>     std::cout << "Date: Apr 7 1969\n" << timeb << std::endl;
>     return 0;
> }
> Stack Trace:
> >	msvcr80d.dll!_mbstowcs_l_helper(wchar_t * pwcs=0x008e2b78, const char * s=0x008e6008, unsigned int n=1812, localeinfo_struct * plocinfo=0x0012f740)  Line 71	C++
>  	msvcr80d.dll!_mbstowcs_s_l(unsigned int * pConvertedChars=0x0012f7b0, wchar_t * pwcs=0x008e2b78, unsigned int sizeInWords=1812, const char * s=0x008e6008, unsigned int n=4294967295, localeinfo_struct * plocinfo=0x0012f7d4)  Line 259 + 0x30 bytes	C++
>  	msvcr80d.dll!_wcsftime_l_stat(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858, localeinfo_struct * plocinfo=0x0012f7d4)  Line 101 + 0x32 bytes	C++
>  	msvcr80d.dll!_wcsftime_l(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858, localeinfo_struct * plocinfo=0x00000000)  Line 152 + 0x1e bytes	C++
>  	msvcr80d.dll!wcsftime(wchar_t * wstring=0x008e2b78, unsigned int maxsize=1812, const wchar_t * wformat=0x00473980, const tm * timeptr=0x0012f858)  Line 162 + 0x17 bytes	C++
>  	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int flags=64, unsigned int inx=0)  Line 695 + 0x28 bytes	C++
>  	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int flags=64, const void * * names=0x0012fc40, unsigned int * sizes=0x0012faa8)  Line 1115 + 0x11 bytes	C++
>  	time_get.exe!__rw::__rw_get_timepunct(const __rw::__rw_facet * pfacet=0x0049465c, int * data=0x0012fa4c, tm * tmb=0x0012fa78, int * * pmem=0x0012fa6c, const void * * names=0x0012fc40, unsigned int * sizes=0x0012faa8)  Line 1452 + 0x23 bytes	C++
>  	time_get.exe!std::time_get<char,std::istreambuf_iterator<char,std::char_traits<char> > >::do_get(std::istreambuf_iterator<char,std::char_traits<char> > __it={...}, std::istreambuf_iterator<char,std::char_traits<char> > __end={...}, std::ios_base & __fl={...}, __rw::__rw_iostate & __err=-858993460, tm * __tmb=0x00492518, char __fmt='x', char __modifier=0)  Line 175 + 0x2c bytes	C++
>  	time_get.exe!std::time_get<char,std::istreambuf_iterator<

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.