Menu

#24 glutTimerFunc() binding could break for sizeof(int)==4 but sizeof(void*)==8

POGL 0.xx
fixed-in-git
None
3
2025-05-11
2016-09-27
No

In the bindings for glutTimerFunc for POGL 0.6704_xx, there is a cast from a pointer type to int for handler_data. This is broken code whenever sizeof(int) < sizeof(void*) A warning sign for this type of problem is the failure to use INT2PTR, PTR2UV, PTR2IV, or PTR2NV for the cast. Marking this low priority for the coming 0.70 release but it needs to be addressed for POGL2 bindings.

void
glutTimerFunc(msecs, handler=0, ...)
        unsigned int    msecs
        SV *    handler
        CODE:
        {
                if (!handler || !SvOK(handler)) {
                        croak("A handler must be specified");
                } else {
                        AV * handler_data = newAV();

                        PackCallbackST(handler_data, 1);

                        glutTimerFunc(msecs, generic_glut_timer_handler, (int)handler_data);
                }
        ENSURE_callback_thread;}

Discussion

  • Florian

    Florian - 2019-02-12

    I think this issue has come up in Debian, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=886496 which has a patch

     
  • mohawk

    mohawk - 2025-05-11
    • status: open --> fixed-in-git
     

Log in to post a comment.

Monday.com Logo