[Python-bugs-list] [Bug #110713] strptime buffer overflow (PR#95)

noreply@sourceforge.net noreply@sourceforge.net
Fri, 25 Aug 2000 10:00:30 -0700


Bug #110713, was updated on 2000-Jul-31 14:30
Here is a current snapshot of the bug.

Project: Python
Category: Library
Status: Open
Resolution: Wont Fix
Bug Group: 3rd Party
Priority: 7
Summary: strptime buffer overflow (PR#95)

Details: Jitterbug-Id: 95
Submitted-By: bridge@gsnet.com
Date: Tue, 5 Oct 1999 12:45:12 -0400 (EDT)
Version: 1.5.2
OS: RedHat 5.2


Hi-

I got a core dump with the following line, and I don't see it in the bug
database.  I inadvertantly put a %X instead of a %Y in the format 
string for strptime:

Python 1.5.2 (#1, Apr 18 1999, 16:03:16)  [GCC pgcc-2.91.60 19981201 (egcs-1.1.1
 on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import time
>>> time.strptime("Oct 28 1999", "%b %d %X")
Segmentation fault (core dumped) 


====================================================================
Audit trail:
Wed Oct 06 11:12:55 1999	guido	changed notes
Wed Oct 06 11:12:55 1999	guido	moved from incoming to platformbug

Follow-Ups:

Date: 2000-Aug-05 03:57
By: nowonder

Comment:
I cannot test this as I do not have RedHat 5.2. It works for me on SuSE Linux 6.4 both with 1.5.2 and the current CVS version.

Somebody with a RedHat 5.2 system should check this out.
-------------------------------------------------------

Date: 2000-Aug-25 10:00
By: jhylton

Comment:
This is not a Python bug.  I can reproduce the core dump using straight C code.  I'm running a RedHat 6.x system with glibc-2.1.2-11.  I will investigate whether this is a known bug.

There doesn't seem to be any way for Python to cope with this.

/* Check for a bug in the local strptime, which manifests itself in
   Python as
   time.strptime("Oct 28 1999", "%b %d %X")
*/

#define _GNU_SOURCE

#include <time.h>

main()
{
    struct tm tm;
    char *result;

    memset((void *)&tm, '\0', sizeof(tm));
    result = strptime("Oct 28 1999", "%b %d %X", &tm);
}

-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=110713&group_id=5470