Message19988
Logged In: YES
user_id=31435
I assume this is specific to Python on Windows using
Microsoft's C, since this workalike plain C program also dies
with a memory error while in the bowels of MS's strftime():
#include <stdio.h>
#include <time.h>
void main() {
struct tm t;
char buf[256];
size_t i;
t.tm_year = 1900 - 1900;
t.tm_mon = 1 - 1;
t.tm_mday = 1;
t.tm_hour = 13;
t.tm_min = 0;
t.tm_sec = 0;
t.tm_wday = -3;
t.tm_yday = 0;
t.tm_isdst = -1;
printf("calling strftime\n");
i = strftime(buf, sizeof(buf), "%a", &t);
printf("i: %d\n", i);
}
The problem is the negative value for tm_wday. MS strftime
isn't defensive, and uses the negative tm_wday to index into
nonsense memory. Ironically, if C had defined the % operator
in the sane way (meaning Python's way <wink>), a negative
tm_wday wouldn't have survived for the C library function to
see. |
|
Date |
User |
Action |
Args |
2007-08-23 14:19:53 | admin | link | issue897625 messages |
2007-08-23 14:19:53 | admin | create | |
|