public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug time/18985] New: Passing out of range data to strftime() causes a segfault
@ 2015-09-20  2:02 a.nielsen at shikadi dot net
  2015-09-20  2:19 ` [Bug time/18985] " ppluzhnikov at google dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: a.nielsen at shikadi dot net @ 2015-09-20  2:02 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=18985

            Bug ID: 18985
           Summary: Passing out of range data to strftime() causes a
                    segfault
           Product: glibc
           Version: 2.22
            Status: NEW
          Severity: normal
          Priority: P2
         Component: time
          Assignee: unassigned at sourceware dot org
          Reporter: a.nielsen at shikadi dot net
  Target Milestone: ---

Created attachment 8620
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8620&action=edit
Test case for printing an out-of-range month name

If you pass out-of-range data to the strftime() function, it will access
invalid memory and cause the calling application to crash.

You can reproduce this error by setting an out-of-range value for the
month, and then supplying a format specifier for the month name.  I have
attached a test case demonstrating this.

I think it would be better for strftime() to return 0, an error, or just a
blank in the output string rather than crashing.  As Mike Frysinger pointed out
on the mailing list, POSIX says "If any of the specified values are outside the
normal range, the characters stored are unspecified."  There is no mention of a
crash.

This is the mailing list thread where this bug was discussed:
https://sourceware.org/ml/libc-help/2015-07/msg00025.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

end of thread, other threads:[~2015-10-29 17:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-20  2:02 [Bug time/18985] New: Passing out of range data to strftime() causes a segfault a.nielsen at shikadi dot net
2015-09-20  2:19 ` [Bug time/18985] " ppluzhnikov at google dot com
2015-09-20  2:22 ` ppluzhnikov at google dot com
2015-09-21  9:56 ` fweimer at redhat dot com
2015-09-26 20:29 ` cvs-commit at gcc dot gnu.org
2015-09-26 20:30 ` ppluzhnikov at google dot com
2015-10-29 17:09 ` jsm28 at gcc dot gnu.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).