Skip to content

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

Closed

Description

@SorenSolari
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']

    Activity

    1. SorenSolari commented on Dec 19, 2015

      SorenSolarimannequin
      MannequinAuthor

      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.

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      on Dec 19, 2015
    3. isoschiz commented on Dec 22, 2015

      isoschizmannequin
      Mannequin

      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.

    4. terryjreedy commented on Jan 12, 2016

      @terryjreedy
      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?

    5. curioswati commented on Jan 15, 2016

      curioswatimannequin
      Mannequin

      Modified according to Serhiy's last comment.

    6. curioswati commented on Feb 7, 2016

      curioswatimannequin
      Mannequin

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

    7. serhiy-storchaka commented on Feb 7, 2016

      @serhiy-storchaka
      Member

      Martin, Antoine, what would you say about this?

    8. isoschiz commented on Feb 20, 2016

      isoschizmannequin
      Mannequin

      3.patch looks good to me.

    9. python-dev commented on Feb 24, 2016

      python-devmannequin
      Mannequin

      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

    10. serhiy-storchaka commented on Feb 24, 2016

      @serhiy-storchaka
      Member

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

    11. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions