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

io.IncrementalNewlineDecoder assign out-of-range value to bitwise struct field #79243

Closed
zhangyangyu opened this issue Oct 25, 2018 · 5 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes topic-IO type-bug An unexpected behavior, bug, or error

Comments

@zhangyangyu
Copy link
Member

BPO 35062
Nosy @zhangyangyu, @pablogsal, @miss-islington, @tirkarthi
PRs
  • bpo-35062: Fix parsing _io.IncrementalNewlineDecoder's *translate* argument. #10217
  • [3.7] bpo-35062: Fix parsing _io.IncrementalNewlineDecoder's *translate* argument. (GH-10217) #10259
  • [3.6] bpo-35062: Fix parsing _io.IncrementalNewlineDecoder's *translate* argument. (GH-10217) #10260
  • [2.7] bpo-35062: Fix parsing _io.IncrementalNewlineDecoder's *translate* argument. (GH-10217) #10262
  • 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 = None
    closed_at = <Date 2018-10-31.12:39:33.914>
    created_at = <Date 2018-10-25.04:03:41.169>
    labels = ['3.8', 'type-bug', '3.7', 'expert-IO']
    title = 'io.IncrementalNewlineDecoder assign out-of-range value to bitwise struct field'
    updated_at = <Date 2018-10-31.12:39:33.913>
    user = 'https://github.com/zhangyangyu'

    bugs.python.org fields:

    activity = <Date 2018-10-31.12:39:33.913>
    actor = 'xiang.zhang'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-10-31.12:39:33.914>
    closer = 'xiang.zhang'
    components = ['IO']
    creation = <Date 2018-10-25.04:03:41.169>
    creator = 'xiang.zhang'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 35062
    keywords = ['patch']
    message_count = 5.0
    messages = ['328407', '328988', '328991', '328992', '328993']
    nosy_count = 4.0
    nosy_names = ['xiang.zhang', 'pablogsal', 'miss-islington', 'xtreak']
    pr_nums = ['10217', '10259', '10260', '10262']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue35062'
    versions = ['Python 2.7', 'Python 3.6', 'Python 3.7', 'Python 3.8']

    @zhangyangyu
    Copy link
    Member Author

    io.IncrementalNewlineDecoder gets a *translate* bitwise struct field, but it could be assigned arbitrary int value. This leads to inconsistent behaviour, evens are evaluated to False and odds to True.

    >>> io.IncrementalNewlineDecoder(encodings.utf_8.IncrementalDecoder(), 4).decode(b"abcd\r\n")
    u'abcd\r\n'
    >>> io.IncrementalNewlineDecoder(encodings.utf_8.IncrementalDecoder(), 5).decode(b"abcd\r\n")
    u'abcd\n'

    @zhangyangyu zhangyangyu added 3.7 (EOL) end of life 3.8 only security fixes topic-IO type-bug An unexpected behavior, bug, or error labels Oct 25, 2018
    @zhangyangyu
    Copy link
    Member Author

    New changeset b08746b by Xiang Zhang in branch 'master':
    bpo-35062: Fix parsing _io.IncrementalNewlineDecoder's *translate* argument. (GH-10217)
    b08746b

    @miss-islington
    Copy link
    Contributor

    New changeset 71b6c1a by Miss Islington (bot) in branch '3.7':
    bpo-35062: Fix parsing _io.IncrementalNewlineDecoder's *translate* argument. (GH-10217)
    71b6c1a

    @miss-islington
    Copy link
    Contributor

    New changeset 907b07e by Miss Islington (bot) in branch '3.6':
    bpo-35062: Fix parsing _io.IncrementalNewlineDecoder's *translate* argument. (GH-10217)
    907b07e

    @miss-islington
    Copy link
    Contributor

    New changeset 05acd44 by Miss Islington (bot) in branch '2.7':
    bpo-35062: Fix parsing _io.IncrementalNewlineDecoder's *translate* argument. (GH-10217)
    05acd44

    @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 topic-IO type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants