[issue31314] email throws exception with oversized header input

2021-06-27 Thread Irit Katriel


Change by Irit Katriel :


--
stage: patch review -> resolved
status: pending -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31314] email throws exception with oversized header input

2021-06-20 Thread Irit Katriel


Irit Katriel  added the comment:

This is working now:

>>> import sys, email
>>> mail = email.message_from_string(
... """From: 
... To: 
... Subject: demo
... 
X-Overlong-Header-Name-causes-python-mail-to-crash-in-re-serialization-example:
...
... Hello
... """)
>>>
>>> mail

>>> message = mail.as_string()
>>> sys.stdout.write(message)
From: 
To: 
Subject: demo
X-Overlong-Header-Name-causes-python-mail-to-crash-in-re-serialization-example:

Hello
158
>>>

--
nosy: +iritkatriel
resolution:  -> fixed
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31314] email throws exception with oversized header input

2017-10-21 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests:  -4037

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31314] email throws exception with oversized header input

2017-10-21 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests: +4037

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31314] email throws exception with oversized header input

2017-10-11 Thread Dong-hee Na

Change by Dong-hee Na :


--
pull_requests:  -3911

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31314] email throws exception with oversized header input

2017-10-10 Thread Dong-hee Na

Dong-hee Na  added the comment:

And my patch was wrong, I will re-upload it soon.

2017-10-11 13:51 GMT+09:00 Dong-hee Na :
>
> Dong-hee Na  added the comment:
>
> I found that when email header's self._firstlinelen value is negative
> then self._split() returns an empty list.
> Because when the self._firstlinelen value is negative value then
> 'targetlen' becomes a negative value.
>
> I will update a patch into calculating self.firstlinelen as same as Python3.
>
> 2017-10-11 0:46 GMT+09:00 Serhiy Storchaka :
>>
>> Serhiy Storchaka  added the comment:
>>
>> PR 3938 fixes this issue, but I'm wondering why self._split() returns an 
>> empty list only for long header names.
>>
>> --
>> nosy: +serhiy.storchaka
>>
>> ___
>> Python tracker 
>> 
>> ___
>
> --
> Chungnam National University | Computer Science & Engineering
>
> Tel: +82 010-3353-9127
> Email: donghee.n...@gmail.com
> Linkedin: https://www.linkedin.com/in/dong-hee-na-2b713b49/
>
> --
>
> ___
> Python tracker 
> 
> ___

-- 
Chungnam National University | Computer Science & Engineering

Tel: +82 010-3353-9127
Email: donghee.n...@gmail.com
Linkedin: https://www.linkedin.com/in/dong-hee-na-2b713b49/

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31314] email throws exception with oversized header input

2017-10-10 Thread Dong-hee Na

Dong-hee Na  added the comment:

I found that when email header's self._firstlinelen value is negative
then self._split() returns an empty list.
Because when the self._firstlinelen value is negative value then
'targetlen' becomes a negative value.

I will update a patch into calculating self.firstlinelen as same as Python3.

2017-10-11 0:46 GMT+09:00 Serhiy Storchaka :
>
> Serhiy Storchaka  added the comment:
>
> PR 3938 fixes this issue, but I'm wondering why self._split() returns an 
> empty list only for long header names.
>
> --
> nosy: +serhiy.storchaka
>
> ___
> Python tracker 
> 
> ___

-- 
Chungnam National University | Computer Science & Engineering

Tel: +82 010-3353-9127
Email: donghee.n...@gmail.com
Linkedin: https://www.linkedin.com/in/dong-hee-na-2b713b49/

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31314] email throws exception with oversized header input

2017-10-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

PR 3938 fixes this issue, but I'm wondering why self._split() returns an empty 
list only for long header names.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31314] email throws exception with oversized header input

2017-10-09 Thread Dong-hee Na

Dong-hee Na  added the comment:

I sent a patch if anyone have a time, please take a look :)

--
nosy: +corona10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31314] email throws exception with oversized header input

2017-10-09 Thread Dong-hee Na

Change by Dong-hee Na :


--
keywords: +patch
pull_requests: +3911
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31314] email throws exception with oversized header input

2017-08-31 Thread Matthias Klose

New submission from Matthias Klose:

[forwarded from https://bugs.debian.org/854001]

$ cat tst.py
#!/usr/bin/env python
import sys
import email

mail = email.message_from_string(
"""From: 
To: 
Subject: demo
X-Overlong-Header-Name-causes-python-mail-to-crash-in-re-serialization-example:

Hello
""")
message = mail.as_string()
sys.stdout.write(message)

$ python tst.py 
Traceback (most recent call last):
  File "tst.py", line 13, in 
message = mail.as_string()
  File "/usr/lib/python2.7/email/message.py", line 137, in as_string
g.flatten(self, unixfrom=unixfrom)
  File "/usr/lib/python2.7/email/generator.py", line 83, in flatten
self._write(msg)
  File "/usr/lib/python2.7/email/generator.py", line 115, in _write
self._write_headers(msg)
  File "/usr/lib/python2.7/email/generator.py", line 164, in _write_headers
v, maxlinelen=self._maxheaderlen, header_name=h).encode()
  File "/usr/lib/python2.7/email/header.py", line 408, in encode
lastchunk, lastcharset = newchunks[-1]
IndexError: list index out of range

--
components: email
messages: 301044
nosy: barry, doko, r.david.murray
priority: normal
severity: normal
status: open
title: email throws exception with oversized header input
versions: Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com