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

Code page decoder incorrectly handles input >2GiB #79553

Closed
serhiy-storchaka opened this issue Dec 1, 2018 · 6 comments
Closed

Code page decoder incorrectly handles input >2GiB #79553

serhiy-storchaka opened this issue Dec 1, 2018 · 6 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

BPO 35372
Nosy @vstinner, @serhiy-storchaka, @miss-islington
PRs
  • bpo-35372: Fix the code page decoder for input > 2 GiB. #10848
  • [3.7] bpo-35372: Fix the code page decoder for input > 2 GiB. (GH-10848) #10859
  • [3.6] bpo-35372: Fix the code page decoder for input > 2 GiB. (GH-10848) #10860
  • 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 2018-12-03.10:40:17.656>
    created_at = <Date 2018-12-01.17:17:56.532>
    labels = ['interpreter-core', '3.8', 'type-bug', '3.7']
    title = 'Code page decoder incorrectly handles input >2GiB'
    updated_at = <Date 2018-12-03.11:43:05.241>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2018-12-03.11:43:05.241>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2018-12-03.10:40:17.656>
    closer = 'serhiy.storchaka'
    components = ['Interpreter Core']
    creation = <Date 2018-12-01.17:17:56.532>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 35372
    keywords = ['patch']
    message_count = 6.0
    messages = ['330855', '330912', '330918', '330921', '330936', '330939']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'serhiy.storchaka', 'miss-islington']
    pr_nums = ['10848', '10859', '10860']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue35372'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8']

    @serhiy-storchaka
    Copy link
    Member Author

    >>> b = b'a'*(2**31-2)+b'\xff'*2
    >>> x, y = codecs.code_page_decode(932, b, 'replace', True)
    >>> len(x)
    2
    >>> x, y
    ('aa', 2147483648)

    @serhiy-storchaka serhiy-storchaka added 3.7 (EOL) end of life 3.8 only security fixes labels Dec 1, 2018
    @serhiy-storchaka serhiy-storchaka self-assigned this Dec 1, 2018
    @serhiy-storchaka serhiy-storchaka added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error labels Dec 1, 2018
    @serhiy-storchaka
    Copy link
    Member Author

    New changeset 4013c17 by Serhiy Storchaka in branch 'master':
    bpo-35372: Fix the code page decoder for input > 2 GiB. (GH-10848)
    4013c17

    @miss-islington
    Copy link
    Contributor

    New changeset bdeb56c by Miss Islington (bot) in branch '3.7':
    bpo-35372: Fix the code page decoder for input > 2 GiB. (GH-10848)
    bdeb56c

    @miss-islington
    Copy link
    Contributor

    New changeset 0f9b668 by Miss Islington (bot) in branch '3.6':
    bpo-35372: Fix the code page decoder for input > 2 GiB. (GH-10848)
    0f9b668

    @vstinner
    Copy link
    Member

    vstinner commented Dec 3, 2018

    Thanks for the fix ;-) I guess that nobody tried this code with a string longer than 2 GiB before you :-)

    @serhiy-storchaka
    Copy link
    Member Author

    Decoding a 2 GiB string takes > 80 seconds on my computer and needs around 14 GiB of memory.

    @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
    3.7 (EOL) end of life 3.8 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants