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

Undefined behavior due to incorrect usage of %p in format strings #80775

Closed
ZackerySpytz mannequin opened this issue Apr 11, 2019 · 4 comments
Closed

Undefined behavior due to incorrect usage of %p in format strings #80775

ZackerySpytz mannequin opened this issue Apr 11, 2019 · 4 comments
Labels
3.7 (EOL) end of life 3.8 (EOL) end of life extension-modules C modules in the Modules dir interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@ZackerySpytz
Copy link
Mannequin

ZackerySpytz mannequin commented Apr 11, 2019

BPO 36594
Nosy @brettcannon, @mdickinson, @skrah, @serhiy-storchaka, @ZackerySpytz
PRs
  • bpo-36594: Fix incorrect use of %p in format strings #12769
  • 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 2019-05-14.03:55:31.826>
    created_at = <Date 2019-04-11.00:10:57.376>
    labels = ['extension-modules', 'interpreter-core', '3.7', '3.8']
    title = 'Undefined behavior due to incorrect usage of %p in format strings'
    updated_at = <Date 2019-05-14.03:55:31.825>
    user = 'https://github.com/ZackerySpytz'

    bugs.python.org fields:

    activity = <Date 2019-05-14.03:55:31.825>
    actor = 'brett.cannon'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-05-14.03:55:31.826>
    closer = 'brett.cannon'
    components = ['Extension Modules', 'Interpreter Core']
    creation = <Date 2019-04-11.00:10:57.376>
    creator = 'ZackerySpytz'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 36594
    keywords = ['patch']
    message_count = 4.0
    messages = ['339907', '340151', '340152', '341564']
    nosy_count = 5.0
    nosy_names = ['brett.cannon', 'mark.dickinson', 'skrah', 'serhiy.storchaka', 'ZackerySpytz']
    pr_nums = ['12769']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue36594'
    versions = ['Python 2.7', 'Python 3.7', 'Python 3.8']

    @ZackerySpytz ZackerySpytz mannequin added 3.7 (EOL) end of life 3.8 (EOL) end of life extension-modules C modules in the Modules dir interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Apr 11, 2019
    @ZackerySpytz
    Copy link
    Mannequin Author

    ZackerySpytz mannequin commented Apr 11, 2019

    The attached PR fixes incorrect usages of %p in format strings.

    @serhiy-storchaka
    Copy link
    Member

    Are not all pointer types (except pointers to functions) automatically converted to/from void*.

    @skrah
    Copy link
    Mannequin

    skrah mannequin commented Apr 13, 2019

    gcc warns with -pedantic:

    ptr.c: In function ‘main’:
    ptr.c:5:13: warning: format ‘%p’ expects argument of type ‘void *’, but argument 2 has type ‘int *’ [-Wformat=]
    printf ("%p", &i);

    It is pedantic indeed, I wonder if machines with different pointer sizes still exist.

    @brettcannon
    Copy link
    Member

    New changeset 1a2252e by Brett Cannon (Zackery Spytz) in branch 'master':
    bpo-36594: Fix incorrect use of %p in format strings (GH-12769)
    1a2252e

    @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 (EOL) end of life extension-modules C modules in the Modules dir interpreter-core (Objects, Python, Grammar, and Parser dirs)
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants