GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ctypes: Crash if manually-created CField instance is used · Issue #78878 · python/cpython

ctypes: Crash if manually-created CField instance is used #78878

New issue
Copy link
New issue
Copy link
Closed
Closed
ctypes: Crash if manually-created CField instance is used#78878
Copy link
Labels
3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.9 (EOL)end of lifeend of lifetopic-ctypestype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump

Description

izbyshev
mannequin
opened on Sep 15, 2018
Issue body actions
BPO 34697
Nosy @amauryfa, @abalkin, @meadori, @berkerpeksag, @serhiy-storchaka, @izbyshev, @tirkarthi, @shihai1991
PRs
  • gh-78878: Fix crash when creating an instance of _ctypes.CField #14837
  • 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 = None
    created_at = <Date 2018-09-15.17:13:13.204>
    labels = ['3.10', 'ctypes', '3.9', 'type-crash', '3.11']
    title = 'ctypes: Crash if manually-created CField instance is used'
    updated_at = <Date 2022-01-23.19:52:13.578>
    user = 'https://github.com/izbyshev'

    bugs.python.org fields:

    activity = <Date 2022-01-23.19:52:13.578>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['ctypes']
    creation = <Date 2018-09-15.17:13:13.204>
    creator = 'izbyshev'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 34697
    keywords = ['patch']
    message_count = 4.0
    messages = ['325448', '347814', '348113', '348944']
    nosy_count = 8.0
    nosy_names = ['amaury.forgeotdarc', 'belopolsky', 'meador.inge', 'berker.peksag', 'serhiy.storchaka', 'izbyshev', 'xtreak', 'shihai1991']
    pr_nums = ['14837']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue34697'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    Linked PRs

    • [3.11] gh-78878: Fix crash when creating an instance of _ctypes.CField (GH-14837) #100413

    Activity

    1. izbyshev commented on Sep 15, 2018

      @izbyshev
      izbyshevmannequin
      on Sep 15, 2018
      MannequinAuthor
      More actions

      It is possible to manually create an instance of private CField type which is used by ctypes to represent fields of Structure and Union types. This instance will be uninitialized because it's normally initialized when instances of Structure/Union are created, so calling its methods may crash the interpreter:

      from ctypes import *
      
      class S(Structure):
          _fields_ = [('x', c_int)]
      
      CField = type(S.x)
      f = CField()
      repr(f) # Crash here

      Is this issue worth fixing?

      If so, is the correct way to set tp_new slot to NULL and fix the internal callers so that users wouldn't be able to create CField instances?

    2. izbyshev
      added
      3.7 (EOL)end of lifeend of life
      3.8 (EOL)end of lifeend of life
      topic-ctypes
      type-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
      on Sep 15, 2018
    3. serhiy-storchaka commented on Jul 13, 2019

      @serhiy-storchaka
      serhiy-storchaka
      on Jul 13, 2019
      Member
      More actions

      Is this issue worth fixing?

      Definitely yes.

      If so, is the correct way to set tp_new slot to NULL and fix the internal callers so that users wouldn't be able to create CField instances?

      I think yes.

      Do you mind to create a PR?

    4. shihai1991 commented on Jul 18, 2019

      @shihai1991
      shihai1991
      on Jul 18, 2019
      Member
      More actions

      I have try to cancel this PyCField_new function, but i am not sure I haven't break the code structure.

    5. shihai1991 commented on Aug 3, 2019

      @shihai1991
      shihai1991
      on Aug 3, 2019
      Member
      More actions

      ping

    6. iritkatriel
      added
      3.9 (EOL)end of lifeend of life
      3.10 (EOL)end of lifeend of life
      3.11only security fixesonly security fixes
      and removed
      3.7 (EOL)end of lifeend of life
      3.8 (EOL)end of lifeend of life
      on Jan 23, 2022
    7. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    8. kumaraditya303
      added a commit that references this issue on Dec 21, 2022

      gh-78878: Fix crash when creating an instance of `_ctypes.CField` (#1…

      d713c54
    9. miss-islington
      added 2 commits that reference this issue on Dec 21, 2022

      pythongh-78878: Fix crash when creating an instance of `_ctypes.CFiel…

      8b8519a

      gh-78878: Fix crash when creating an instance of `_ctypes.CField` (GH…

      3e715e0
    10. kumaraditya303
      closed this as completedon Dec 21, 2022
    11. iritkatriel
      added a commit that references this issue on Dec 28, 2022

      Merged main into regmachine branch (#50)

      fdc73cb
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.9 (EOL)end of lifeend of lifetopic-ctypestype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions

        You are visitor 01402503 — GeezerVison does not store the pages you look up.
        Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.