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

Base 85 encoding initialization race condition #83249

Closed
drmonkeysee mannequin opened this issue Dec 16, 2019 · 4 comments
Closed

Base 85 encoding initialization race condition #83249

drmonkeysee mannequin opened this issue Dec 16, 2019 · 4 comments
Labels
3.8 only security fixes 3.9 only security fixes 3.10 only security fixes stdlib Python modules in the Lib dir type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@drmonkeysee
Copy link
Mannequin

drmonkeysee mannequin commented Dec 16, 2019

BPO 39068
Nosy @serhiy-storchaka, @miss-islington, @drmonkeysee
PRs
  • bpo-39068 guard _b85chars2 initialization #17627
  • [3.9] bpo-39068: Fix race condition in base64 (GH-17627) #24020
  • [3.8] bpo-39068: Fix race condition in base64 (GH-17627) #24022
  • [3.9] bpo-39068: Fix race condition in base64 (GH-17627) #24051
  • 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 2021-01-01.20:46:37.998>
    created_at = <Date 2019-12-16.17:55:04.510>
    labels = ['3.8', '3.10', 'library', '3.9', 'type-crash']
    title = 'Base 85 encoding initialization race condition'
    updated_at = <Date 2021-01-01.20:46:37.997>
    user = 'https://github.com/drmonkeysee'

    bugs.python.org fields:

    activity = <Date 2021-01-01.20:46:37.997>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-01-01.20:46:37.998>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2019-12-16.17:55:04.510>
    creator = 'drmonkeysee'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 39068
    keywords = ['patch']
    message_count = 4.0
    messages = ['358495', '384107', '384190', '384205']
    nosy_count = 3.0
    nosy_names = ['serhiy.storchaka', 'miss-islington', 'drmonkeysee']
    pr_nums = ['17627', '24020', '24022', '24051']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue39068'
    versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

    @drmonkeysee
    Copy link
    Mannequin Author

    drmonkeysee mannequin commented Dec 16, 2019

    Under multi-threading scenarios a race condition may occur where a thread sees an initialized _b85chars table but an uninitialized _b85chars2 table due to the guard only checking the first table.

    This causes an exception like:

      File "/usr/lib/python3.6/base64.py", line 434, in b85encode
        return _85encode(b, _b85chars, _b85chars2, pad),
      File "/usr/lib/python3.6/base64.py", line 294, in _85encode
        for word in words],
      File "/usr/lib/python3.6/base64.py", line 294, in <listcomp>
        for word in words],
     "TypeError: 'NoneType' object is not subscriptable
    

    @drmonkeysee drmonkeysee mannequin added stdlib Python modules in the Lib dir type-crash A hard crash of the interpreter, possibly with a core dump labels Dec 16, 2019
    @drmonkeysee drmonkeysee mannequin changed the title Base 85 encoding initialization race conditiong Base 85 encoding initialization race condition Dec 16, 2019
    @drmonkeysee drmonkeysee mannequin changed the title Base 85 encoding initialization race conditiong Base 85 encoding initialization race condition Dec 16, 2019
    @serhiy-storchaka
    Copy link
    Member

    New changeset 9655434 by Brandon Stansbury in branch 'master':
    bpo-39068: Fix race condition in base64 (GH-17627)
    9655434

    @serhiy-storchaka
    Copy link
    Member

    New changeset b863607 by Serhiy Storchaka in branch '3.8':
    [3.8] bpo-39068: Fix race condition in base64 (GH-17627) (GH-24022)
    b863607

    @miss-islington
    Copy link
    Contributor

    New changeset 0d6e407 by Miss Islington (bot) in branch '3.9':
    bpo-39068: Fix race condition in base64 (GH-17627)
    0d6e407

    @serhiy-storchaka serhiy-storchaka added 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes labels Jan 1, 2021
    @serhiy-storchaka serhiy-storchaka added 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes labels Jan 1, 2021
    @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.8 only security fixes 3.9 only security fixes 3.10 only security fixes stdlib Python modules in the Lib dir type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants