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
2a19074a
Commit
2a19074a
authored
Apr 13, 2006
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace INT_MAX with PY_SSIZE_T_MAX where string length
are concerned.
parent
2308915b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
Objects/fileobject.c
Objects/fileobject.c
+4
-4
No files found.
Objects/fileobject.c
View file @
2a19074a
...
...
@@ -823,7 +823,7 @@ file_read(PyFileObject *f, PyObject *args)
buffersize
=
new_buffersize
(
f
,
(
size_t
)
0
);
else
buffersize
=
bytesrequested
;
if
(
buffersize
>
IN
T_MAX
)
{
if
(
buffersize
>
PY_SSIZE_
T_MAX
)
{
PyErr_SetString
(
PyExc_OverflowError
,
"requested number of bytes is more than a Python string can hold"
);
return
NULL
;
...
...
@@ -1098,7 +1098,7 @@ getline_via_fgets(FILE *fp)
assert
(
*
(
pvend
-
1
)
==
'\0'
);
increment
=
total_v_size
>>
2
;
/* mild exponential growth */
total_v_size
+=
increment
;
if
(
total_v_size
>
IN
T_MAX
)
{
if
(
total_v_size
>
PY_SSIZE_
T_MAX
)
{
PyErr_SetString
(
PyExc_OverflowError
,
"line is longer than a Python string can hold"
);
Py_DECREF
(
v
);
...
...
@@ -1209,7 +1209,7 @@ get_line(PyFileObject *f, int n)
used_v_size
=
total_v_size
;
increment
=
total_v_size
>>
2
;
/* mild exponential growth */
total_v_size
+=
increment
;
if
(
total_v_size
>
IN
T_MAX
)
{
if
(
total_v_size
>
PY_SSIZE_
T_MAX
)
{
PyErr_SetString
(
PyExc_OverflowError
,
"line is longer than a Python string can hold"
);
Py_DECREF
(
v
);
...
...
@@ -1401,7 +1401,7 @@ file_readlines(PyFileObject *f, PyObject *args)
/* Need a larger buffer to fit this line */
nfilled
+=
nread
;
buffersize
*=
2
;
if
(
buffersize
>
IN
T_MAX
)
{
if
(
buffersize
>
PY_SSIZE_
T_MAX
)
{
PyErr_SetString
(
PyExc_OverflowError
,
"line is longer than a Python string can hold"
);
goto
error
;
...
...
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