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 — gh-111178: Avoid calling functions from incompatible pointer types in _tkinter.c by chrstphrchvz · Pull Request #112893 · python/cpython

Conversation

@chrstphrchvz

@chrstphrchvz chrstphrchvz commented Dec 9, 2023 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Potential compiler warnings eliminated:

./Modules/_tkinter.c:819:18: warning: cast from 'PyObject *(*)(PyTclObject *, void *)' (aka 'struct _object *(*)(PyTclObject *, void *)') to 'getter' (aka 'struct _object *(*)(struct _object *, void *)') converts to incompatible function type [-Wcast-function-type-strict]
  819 |     {"typename", (getter)get_typename, NULL, get_typename__doc__},
      |                  ^~~~~~~~~~~~~~~~~~~~
./Modules/_tkinter.c:820:16: warning: cast from 'PyObject *(*)(PyTclObject *, void *)' (aka 'struct _object *(*)(PyTclObject *, void *)') to 'getter' (aka 'struct _object *(*)(struct _object *, void *)') converts to incompatible function type [-Wcast-function-type-strict]
  820 |     {"string", (getter)PyTclObject_string, NULL,
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~
./Modules/_tkinter.c:826:21: warning: cast from 'void (*)(PyTclObject *)' to 'destructor' (aka 'void (*)(struct _object *)') converts to incompatible function type [-Wcast-function-type-strict]
  826 |     {Py_tp_dealloc, (destructor)PyTclObject_dealloc},
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Modules/_tkinter.c:827:18: warning: cast from 'PyObject *(*)(PyTclObject *)' (aka 'struct _object *(*)(PyTclObject *)') to 'reprfunc' (aka 'struct _object *(*)(struct _object *)') converts to incompatible function type [-Wcast-function-type-strict]
  827 |     {Py_tp_repr, (reprfunc)PyTclObject_repr},
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
./Modules/_tkinter.c:828:17: warning: cast from 'PyObject *(*)(PyTclObject *)' (aka 'struct _object *(*)(PyTclObject *)') to 'reprfunc' (aka 'struct _object *(*)(struct _object *)') converts to incompatible function type [-Wcast-function-type-strict]
  828 |     {Py_tp_str, (reprfunc)PyTclObject_str},
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~
./Modules/_tkinter.c:1388:23: warning: cast from 'int (*)(Tkapp_CallEvent *, int)' (aka 'int (*)(struct Tkapp_CallEvent *, int)') to 'Tcl_EventProc *' (aka 'int (*)(struct Tcl_Event *, int)') converts to incompatible function type [-Wcast-function-type-strict]
 1388 |         ev->ev.proc = (Tcl_EventProc*)Tkapp_CallProc;
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Modules/_tkinter.c:1666:23: warning: cast from 'int (*)(VarEvent *, int)' (aka 'int (*)(struct VarEvent *, int)') to 'Tcl_EventProc *' (aka 'int (*)(struct Tcl_Event *, int)') converts to incompatible function type [-Wcast-function-type-strict]
 1666 |         ev->ev.proc = (Tcl_EventProc*)var_proc;
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~
./Modules/_tkinter.c:2293:23: warning: cast from 'int (*)(CommandEvent *, int)' (aka 'int (*)(struct CommandEvent *, int)') to 'Tcl_EventProc *' (aka 'int (*)(struct Tcl_Event *, int)') converts to incompatible function type [-Wcast-function-type-strict]
 2293 |         ev->ev.proc = (Tcl_EventProc*)Tkapp_CommandProc;
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./Modules/_tkinter.c:2346:23: warning: cast from 'int (*)(CommandEvent *, int)' (aka 'int (*)(struct CommandEvent *, int)') to 'Tcl_EventProc *' (aka 'int (*)(struct Tcl_Event *, int)') converts to incompatible function type [-Wcast-function-type-strict]
 2346 |         ev->ev.proc = (Tcl_EventProc*)Tkapp_CommandProc;
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • Issue: UBSan: Calling a function through pointer to incorrect function type is undefined behavior #111178

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
chrstphrchvz added 6 commits December 9, 2023 00:09
@chrstphrchvz
Make functions compatible with Tcl_EventProc where needed
f5bd621
@chrstphrchvz
Make PyTclObject_string() compatible with getter
cb062e3
@chrstphrchvz
Make get_typename() compatible with getter
c309917
@chrstphrchvz
Make PyTclObject_repr() compatible with reprfunc
98c082d
@chrstphrchvz
Make PyTclObject_str() compatible with reprfunc
352876b
@chrstphrchvz
Make PyTclObject_dealloc() compatible with destructor
001b4cf
@bedevere-app bedevere-app Bot added the awaiting review label Dec 9, 2023
@bedevere-app bedevere-app Bot mentioned this pull request Dec 9, 2023
UBSan: Calling a function through pointer to incorrect function type is undefined behavior #111178
Closed
@encukou encukou added the skip news label Dec 11, 2023
encukou
encukou approved these changes Jan 2, 2024
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Jan 2, 2024
@encukou
encukou merged commit f637b44 into python:main Jan 2, 2024
@bedevere-app bedevere-app Bot removed the awaiting merge label Jan 2, 2024
@chrstphrchvz
chrstphrchvz deleted the patch-111178-tkinter branch January 2, 2024 23:32
kulikjak pushed a commit to kulikjak/cpython that referenced this pull request Jan 22, 2024
@chrstphrchvz @kulikjak
pythongh-111178: Avoid calling functions from incompatible pointer ty…
fe4b75b
…pes in _tkinter.c (pythonGH-112893)

Fix undefined behavior warnings (UBSan  -fsanitize=function).
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
@chrstphrchvz @aisk
pythongh-111178: Avoid calling functions from incompatible pointer ty…
9e36919
…pes in _tkinter.c (pythonGH-112893)

Fix undefined behavior warnings (UBSan  -fsanitize=function).
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
@chrstphrchvz @Glyphack
pythongh-111178: Avoid calling functions from incompatible pointer ty…
e39aebe
…pes in _tkinter.c (pythonGH-112893)

Fix undefined behavior warnings (UBSan  -fsanitize=function).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@encukou encukou encukou approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@chrstphrchvz @encukou
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — 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.