Skip to content
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

base64.a85decode adobe flag incorrectly utilizes <~ as a marker causing error #70101

Closed
SorenSolari mannequin opened this issue Dec 19, 2015 · 9 comments
Closed

base64.a85decode adobe flag incorrectly utilizes <~ as a marker causing error #70101

SorenSolari mannequin opened this issue Dec 19, 2015 · 9 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@SorenSolari
Copy link
Mannequin

SorenSolari mannequin commented Dec 19, 2015

BPO 25913
Nosy @terryjreedy, @pitrou, @serhiy-storchaka
Files
  • iss_25913.patch: Fix on the basis of comments.
  • iss_25913_2.patch
  • iss_25913_3.patch: Corrects the test.
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2016-02-24.10:13:00.441>
    created_at = <Date 2015-12-19.23:31:52.977>
    labels = ['type-bug', 'library']
    title = 'base64.a85decode adobe flag incorrectly utilizes <~ as a marker causing error'
    updated_at = <Date 2016-02-24.10:13:00.439>
    user = 'https://bugs.python.org/SorenSolari'

    bugs.python.org fields:

    activity = <Date 2016-02-24.10:13:00.439>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2016-02-24.10:13:00.441>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2015-12-19.23:31:52.977>
    creator = 'Soren Solari'
    dependencies = []
    files = ['41377', '41393', '41621']
    hgrepos = []
    issue_num = 25913
    keywords = ['patch']
    message_count = 9.0
    messages = ['256745', '256842', '258080', '258268', '259767', '259802', '260570', '260781', '260782']
    nosy_count = 7.0
    nosy_names = ['terry.reedy', 'pitrou', 'python-dev', 'serhiy.storchaka', 'isoschiz', 'curioswati', 'Soren Solari']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue25913'
    versions = ['Python 3.5', 'Python 3.6']

    @SorenSolari
    Copy link
    Mannequin Author

    SorenSolari mannequin commented Dec 19, 2015

    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.

    @SorenSolari SorenSolari mannequin added the type-bug An unexpected behavior, bug, or error label Dec 19, 2015
    @serhiy-storchaka serhiy-storchaka added the stdlib Python modules in the Lib dir label Dec 19, 2015
    @isoschiz
    Copy link
    Mannequin

    isoschiz mannequin commented Dec 22, 2015

    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.

    @terryjreedy
    Copy link
    Member

    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?

    @curioswati
    Copy link
    Mannequin

    curioswati mannequin commented Jan 15, 2016

    Modified according to Serhiy's last comment.

    @curioswati
    Copy link
    Mannequin

    curioswati mannequin commented Feb 7, 2016

    Is there any requirement for further modification or it can be accepted?

    @serhiy-storchaka
    Copy link
    Member

    Martin, Antoine, what would you say about this?

    @isoschiz
    Copy link
    Mannequin

    isoschiz mannequin commented Feb 20, 2016

    3.patch looks good to me.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Feb 24, 2016

    New changeset ce5bf3290621 by Serhiy Storchaka in branch '3.5':
    Issue bpo-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 bpo-25913: Leading <~ is optional now in base64.a85decode() with adobe=True.
    https://hg.python.org/cpython/rev/90d5473b8673

    @serhiy-storchaka
    Copy link
    Member

    Thank you Soren for your report, thank you Swati for your patch, and thank you Martin for your review.

    @serhiy-storchaka serhiy-storchaka self-assigned this Feb 24, 2016
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants