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

binascii.crc_hqx() can return negative integer #67916

Closed
serhiy-storchaka opened this issue Mar 20, 2015 · 3 comments
Closed

binascii.crc_hqx() can return negative integer #67916

serhiy-storchaka opened this issue Mar 20, 2015 · 3 comments
Assignees
Labels
easy extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

BPO 23728
Nosy @gpshead, @serhiy-storchaka
Files
  • binascii_crc_hqx_empty_data.patch
  • 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 2015-04-20.08:25:22.999>
    created_at = <Date 2015-03-20.21:52:50.158>
    labels = ['extension-modules', 'easy', 'type-bug']
    title = 'binascii.crc_hqx() can return negative integer'
    updated_at = <Date 2015-04-20.08:25:22.999>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2015-04-20.08:25:22.999>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2015-04-20.08:25:22.999>
    closer = 'serhiy.storchaka'
    components = ['Extension Modules']
    creation = <Date 2015-03-20.21:52:50.158>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['38834']
    hgrepos = []
    issue_num = 23728
    keywords = ['patch', 'easy']
    message_count = 3.0
    messages = ['238726', '240087', '241616']
    nosy_count = 3.0
    nosy_names = ['gregory.p.smith', 'python-dev', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue23728'
    versions = ['Python 3.4', 'Python 3.5']

    @serhiy-storchaka
    Copy link
    Member Author

    zlib.adler32(), zlib.crc32(), and binascii.crc32() always return 32-bit unsigned integer in Python 3. binascii.crc_hqx() almost always returns 16-bit unsigned integer. But there is an exception. The result can negative only when arguments of binascii.crc_hqx() are empty bytes and negative integer. This looks as a bug and should be fixed. But may be no need to apply changes to maintained releases.

    @serhiy-storchaka serhiy-storchaka added extension-modules C modules in the Modules dir easy type-bug An unexpected behavior, bug, or error labels Mar 20, 2015
    @serhiy-storchaka
    Copy link
    Member Author

    Nobody proposed a patch, so I do this.

    @serhiy-storchaka serhiy-storchaka self-assigned this Apr 4, 2015
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Apr 20, 2015

    New changeset 0ead02929df2 by Serhiy Storchaka in branch '3.4':
    Issue bpo-23728: binascii.crc_hqx() could return an integer outside of the range
    https://hg.python.org/cpython/rev/0ead02929df2

    New changeset abb86c6b11b2 by Serhiy Storchaka in branch 'default':
    Issue bpo-23728: binascii.crc_hqx() could return an integer outside of the range
    https://hg.python.org/cpython/rev/abb86c6b11b2

    New changeset 17702fd8ac0d by Serhiy Storchaka in branch '2.7':
    Issue bpo-23728: Added a test for binascii.crc_hqx().
    https://hg.python.org/cpython/rev/17702fd8ac0d

    @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
    easy extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant