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.

classification
Title: base64.a85decode adobe flag incorrectly utilizes <~ as a marker causing error
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: Soren Solari, curioswati, isoschiz, pitrou, python-dev, serhiy.storchaka, terry.reedy
Priority: normal Keywords: patch

Created on 2015-12-19 23:31 by Soren Solari, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
iss_25913.patch curioswati, 2015-12-21 05:34 Fix on the basis of comments. review
iss_25913_2.patch curioswati, 2015-12-23 04:41 review
iss_25913_3.patch curioswati, 2016-01-15 05:48 Corrects the test. review
Messages (9)
msg256745 - (view) Author: Soren Solari (Soren Solari) Date: 2015-12-19 23:31
According to the PDF Spec http://www.adobe.com/devnet/pdf/pdf_reference.html section 7.4.3,
The ascii85decode function only utilizes ~> as an EOD 2byte character, there is no mention of leading <~.   Therefore using the base64.a85decode(data, adobe=True) does not work on valid data coming from a pdf because that data may not have a leading <~.

Solution: do not require leading <~ for adobe=True.
msg256842 - (view) Author: Martin Morrison (isoschiz) * Date: 2015-12-22 16:10
The proposed patch does stop requiring the leading <~, but still trims the first two characters off the data set. This will no doubt fail in cases where there is no leading marker.

I think it will need to explicitly handle the case where the leading marker is there vs. not.
msg258080 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-01-12 08:50
Soren, for me, the page you link to is impossible to read as it blinks every second or so, something I have never seen before.  Perhaps it is trying to forward to the actual reference. As near as I can tell, it just lists about 3 other documents and is not a reference in itself, and for me has no sections.  Can you provide a better link, perhaps one that is more direct?
msg258268 - (view) Author: Swati Jaiswal (curioswati) * Date: 2016-01-15 05:48
Modified according to Serhiy's last comment.
msg259767 - (view) Author: Swati Jaiswal (curioswati) * Date: 2016-02-07 07:11
Is there any requirement for further modification or it can be accepted?
msg259802 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-02-07 21:04
Martin, Antoine, what would you say about this?
msg260570 - (view) Author: Martin Morrison (isoschiz) * Date: 2016-02-20 18:24
3.patch looks good to me.
msg260781 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-02-24 10:08
New changeset ce5bf3290621 by Serhiy Storchaka in branch '3.5':
Issue #25913: Leading <~ is optional now in base64.a85decode() with adobe=True.
https://hg.python.org/cpython/rev/ce5bf3290621

New changeset 90d5473b8673 by Serhiy Storchaka in branch 'default':
Issue #25913: Leading <~ is optional now in base64.a85decode() with adobe=True.
https://hg.python.org/cpython/rev/90d5473b8673
msg260782 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-02-24 10:13
Thank you Soren for your report, thank you Swati for your patch, and thank you Martin for your review.
History
Date User Action Args
2022-04-11 14:58:25adminsetgithub: 70101
2016-02-24 10:13:00serhiy.storchakasetstatus: open -> closed
messages: + msg260782

assignee: serhiy.storchaka
resolution: fixed
stage: test needed -> resolved
2016-02-24 10:08:34python-devsetnosy: + python-dev
messages: + msg260781
2016-02-20 18:24:14isoschizsetmessages: + msg260570
2016-02-07 21:04:58serhiy.storchakasetmessages: + msg259802
2016-02-07 07:11:44curioswatisetmessages: + msg259767
2016-01-15 05:48:09curioswatisetfiles: + iss_25913_3.patch

messages: + msg258268
2016-01-12 21:04:24zach.waresetnosy: + curioswati
2016-01-12 08:50:27terry.reedysetnosy: + terry.reedy

messages: + msg258080
stage: test needed
2015-12-23 04:41:59curioswatisetfiles: + iss_25913_2.patch
2015-12-22 16:10:12isoschizsetmessages: + msg256842
2015-12-21 05:34:09curioswatisetfiles: + iss_25913.patch
keywords: + patch
2015-12-19 23:52:26serhiy.storchakasetnosy: + pitrou, serhiy.storchaka, isoschiz

components: + Library (Lib)
versions: + Python 3.6
2015-12-19 23:31:52Soren Solaricreate