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
003a5e70
Commit
003a5e70
authored
Apr 28, 2010
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use PyErr_Format() in decoding_fgets()
Avoid a buffer of 500 bytes allocated on the stack.
parent
740f53a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
3 deletions
+1
-3
Parser/tokenizer.c
Parser/tokenizer.c
+1
-3
No files found.
Parser/tokenizer.c
View file @
003a5e70
...
...
@@ -580,16 +580,14 @@ decoding_fgets(char *s, int size, struct tok_state *tok)
}
}
if
(
badchar
)
{
char
buf
[
500
];
/* Need to add 1 to the line number, since this line
has not been counted, yet. */
sprintf
(
buf
,
PyErr_Format
(
PyExc_SyntaxError
,
"Non-UTF-8 code starting with '
\\
x%.2x' "
"in file %.200s on line %i, "
"but no encoding declared; "
"see http://python.org/dev/peps/pep-0263/ for details"
,
badchar
,
tok
->
filename
,
tok
->
lineno
+
1
);
PyErr_SetString
(
PyExc_SyntaxError
,
buf
);
return
error_ret
(
tok
);
}
#endif
...
...
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