public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/3944] New: strptime() segfaults on certain date formats
@ 2007-01-30 21:05 pandisv at yahoo dot co dot uk
  2007-02-09  1:45 ` [Bug libc/3944] " drepper at redhat dot com
  2007-07-12 14:51 ` cvs-commit at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: pandisv at yahoo dot co dot uk @ 2007-01-30 21:05 UTC (permalink / raw)
  To: glibc-bugs

Hello,

this is a bug originally reported at https://bugs.launchpad.net/bugs/50563 . An
Ubuntu user reported the following:

"This segfaults on Ubuntu Dapper:

#define _XOPEN_SOURCE
#include <time.h>
int main() {
  struct tm tm;
  strptime("2004", "%Y", &tm); /* Segfault. */
  return 0;
}

This does not:

#define _XOPEN_SOURCE
#include <time.h>
int main() {
  struct tm tm;
  strptime("2004-01-01", "%Y-%m-%d", &tm); /* OK. */
  strptime("2004-01", "%Y-%m", &tm); /* OK. */
  return 0;
}

Internally, strptime() sets up a "struct tm" when parsing the date string. If
both the month and day-of-month are not present, two fields in that struct are
left uninitialized, and the segfault occurs when the uninitialized values are
used in an array lookup in time/strptime_l.c:day_of_the_week().

I have a patch for this, but cannot be sure that it works, because I don't have
enough disk space or CPU time for a glibc build."


Unfortunately, we haven't been able to contact the user for a patch. At any
rate, it would be nice if this were fixed. Thanks!

-- 
           Summary: strptime() segfaults on certain date formats
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: pandisv at yahoo dot co dot uk
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=3944

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-07-12 14:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-30 21:05 [Bug libc/3944] New: strptime() segfaults on certain date formats pandisv at yahoo dot co dot uk
2007-02-09  1:45 ` [Bug libc/3944] " drepper at redhat dot com
2007-07-12 14:51 ` cvs-commit at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).