This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients barry, christian.heimes, jader.fabiano, pitrou, r.david.murray, rhettinger, serhiy.storchaka, tshepang
Date 2014-08-06.05:43:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1407303818.44.0.465395668427.issue21448@psf.upfronthosting.co.za>
In-reply-to
Content
I found a bug in my patch. Following code

from email.parser import Parser
BLOCKSIZE = 8192
s = 'From: <e@example.com>\nFoo: '
s += 'x' * ((-len(s) - 1) % BLOCKSIZE) + '\rBar: '
s += 'y' * ((-len(s) - 1) % BLOCKSIZE) + '\x85Baz: '
s += 'z' * ((-len(s) - 1) % BLOCKSIZE) + '\n\n'
print(Parser().parsestr(s).keys())

outputs ['From', 'Foo', 'Bar', 'Baz'] on current code and ['From', 'Foo', 'Bar'] with my patch. Neither current code, nor Reimonds patch are not affected by similar bugs. It is possible to fix my patch, but then it will become too complicated and slower.

I have one doubt about one special case with Raymond's patch, but looking at current code on highter level, this doesn't matter. Current code in FeedParser in any case is not very efficient and smoothes out any implementation details in BufferedSubFile. That is why fix_prepending2.diff has no visible effect on email parsing.

I'll provided additional tests which cover current issue and a bug in my patch.

> That is, it sounds like you are saying there is a pre-existing bug that we may want to address?  In which case it should presumably be a separate issue.

I can't create an example. May be higher level code is tolerant to it. I'll created separate issue if found an example.

> Should this be categorized as a security issue?

Yes, but not very important. You need send tens or hundreds of megabytes to hang a server more than a second.
History
Date User Action Args
2014-08-06 05:43:38serhiy.storchakasetrecipients: + serhiy.storchaka, barry, rhettinger, pitrou, christian.heimes, r.david.murray, tshepang, jader.fabiano
2014-08-06 05:43:38serhiy.storchakasetmessageid: <1407303818.44.0.465395668427.issue21448@psf.upfronthosting.co.za>
2014-08-06 05:43:38serhiy.storchakalinkissue21448 messages
2014-08-06 05:43:37serhiy.storchakacreate