-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
UnboundLocalError
in email._header_value_parser.parse_message_id
#134152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
parse_message_id
email._header_value_parser.parse_message_id
Do we want to fix private APIs? |
In general no, but UnboundLocalError is pretty much a real issue, even in a private API, so I think we should fix this one at least. We don't need to fix the HeaderParseError, but we need to fix the UnboundLocalError. |
I have a patch, want to send it in a couple of hours. |
@picnixz Please take a look. |
email._header_value_parser.parse_message_id
UnboundLocalError
in email._header_value_parser.parse_message_id
…thub.com:sergey-miryanov/cpython into pythongh-134152-fix-unbound-local-error-in-email
…text_to_endchars (#134233) Fix an UnboundLocalError that can occur when parsing certain delimited constructs in headers (domain literals, quoted strings, comments). After the fix the _get_ptext_to_endchars returns an empty string if there is no content after the opening delimiter. The calling code is responsible for handling the lack of the trailing delimiter, which it already does; this edge case was the header ending immediately after the opening delimiter.
…_get_ptext_to_endchars (pythonGH-134233) Fix an UnboundLocalError that can occur when parsing certain delimited constructs in headers (domain literals, quoted strings, comments). After the fix the _get_ptext_to_endchars returns an empty string if there is no content after the opening delimiter. The calling code is responsible for handling the lack of the trailing delimiter, which it already does; this edge case was the header ending immediately after the opening delimiter. (cherry picked from commit a32ea45) Co-authored-by: R. David Murray <rdmurray@bitdance.com>
…_get_ptext_to_endchars (pythonGH-134233) Fix an UnboundLocalError that can occur when parsing certain delimited constructs in headers (domain literals, quoted strings, comments). After the fix the _get_ptext_to_endchars returns an empty string if there is no content after the opening delimiter. The calling code is responsible for handling the lack of the trailing delimiter, which it already does; this edge case was the header ending immediately after the opening delimiter. (cherry picked from commit a32ea45) Co-authored-by: R. David Murray <rdmurray@bitdance.com>
Is it actually entirely fixed by #134233? |
The issue reported here is. In the course of testing sergey-miryanov also noticed a related but separate bug, which was already separately reported in #134155, which is fixed by his PR that will land soonish. |
Uh oh!
There was an error while loading. Please reload this page.
During fuzzing of Python standard libraries, the following code snippet causes an
UnboundLocalError
with the following message:UnboundLocalError: cannot access local variable 'pos' where it is not associated with a value'
. This occurs in the_get_ptext_to_endchars
function at line 1035 inemail/_header_value_parser.py
.Exception Trace
CPython versions tested on:
3.12, 3.11, 3.10, 3.9
Operating systems tested on:
Linux
Linked PRs
The text was updated successfully, but these errors were encountered: