Skip to content
Snippets Groups Projects
  • Tom Lane's avatar
    23a41573
    Adjust DatumGetBool macro so that it isn't fooled by garbage in the Datum · 23a41573
    Tom Lane authored
    to the left of the actual bool value.  While in most cases there won't be
    any, our support for old-style user-defined functions violates the C spec
    to the extent of calling functions that might return char or short through
    a function pointer declared to return "char *", which we then coerce to
    Datum.  It is not surprising that the result might contain garbage
    high-order bits ... what is surprising is that we didn't see such cases
    long ago.  Per report from Magnus.
    23a41573
    History
    Adjust DatumGetBool macro so that it isn't fooled by garbage in the Datum
    Tom Lane authored
    to the left of the actual bool value.  While in most cases there won't be
    any, our support for old-style user-defined functions violates the C spec
    to the extent of calling functions that might return char or short through
    a function pointer declared to return "char *", which we then coerce to
    Datum.  It is not surprising that the result might contain garbage
    high-order bits ... what is surprising is that we didn't see such cases
    long ago.  Per report from Magnus.