Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
f711a90e
Commit
f711a90e
authored
Sep 08, 2015
by
Steve Dower
Browse files
Options
Browse Files
Download
Plain Diff
Merge fix for #25029
parents
f772e914
97cded93
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
13 deletions
+7
-13
Modules/timemodule.c
Modules/timemodule.c
+7
-13
No files found.
Modules/timemodule.c
View file @
f711a90e
...
...
@@ -648,9 +648,6 @@ time_strftime(PyObject *self, PyObject *args)
* will be ahead of time...
*/
for
(
i
=
1024
;
;
i
+=
i
)
{
#if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__)
int
err
;
#endif
outbuf
=
(
time_char
*
)
PyMem_Malloc
(
i
*
sizeof
(
time_char
));
if
(
outbuf
==
NULL
)
{
PyErr_NoMemory
();
...
...
@@ -660,10 +657,14 @@ time_strftime(PyObject *self, PyObject *args)
buflen
=
format_time
(
outbuf
,
i
,
fmt
,
&
buf
);
_Py_END_SUPPRESS_IPH
#if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__)
err
=
errno
;
/* VisualStudio .NET 2005 does this properly */
if
(
buflen
==
0
&&
errno
==
EINVAL
)
{
PyErr_SetString
(
PyExc_ValueError
,
"Invalid format string"
);
PyMem_Free
(
outbuf
);
break
;
}
#endif
if
(
buflen
>
0
||
fmtlen
==
0
||
(
fmtlen
>
4
&&
i
>=
256
*
fmtlen
))
{
if
(
buflen
>
0
||
i
>=
256
*
fmtlen
)
{
/* If the buffer is 256 times as long as the format,
it's probably not failing for lack of room!
More likely, the format yields an empty result,
...
...
@@ -679,13 +680,6 @@ time_strftime(PyObject *self, PyObject *args)
break
;
}
PyMem_Free
(
outbuf
);
#if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__)
/* VisualStudio .NET 2005 does this properly */
if
(
buflen
==
0
&&
err
==
EINVAL
)
{
PyErr_SetString
(
PyExc_ValueError
,
"Invalid format string"
);
break
;
}
#endif
}
#ifdef HAVE_WCSFTIME
PyMem_Free
(
format
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment