Skip to content
  • Martin Pitt's avatar
    Fix signedness, overflow checking, and 32 bit overflow of GFlags · caeeeb7e
    Martin Pitt authored
    GFlagsValue.value is a guint, so we must access it as unsigned type. Define two
    new macros PYGLIB_PyLong_FromUnsignedLong() and PYGLIB_PyLong_AsUnsignedLong()
    for that purpose, and consistently use them for handling flag values. Use the
    checked variant of these functions which produce OverflowErrors instead
    of the unchecked PYGLIB_PyLong_AS_LONG().
    
    Insert zero padding after the PyLongObject in PyGFlags and PyGEnum. Without
    this, the directly adjacent GType field seems to confuse
    PyLong_FromUnsignedLong() and includes the GType into the numeric value.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=693121
    caeeeb7e