Changeset ef06c74 in mod_gnutls for src/gnutls_util.c


Ignore:
Timestamp:
Jun 18, 2016, 3:18:36 PM (4 years ago)
Author:
Thomas Klute <thomas2.klute@…>
Branches:
debian/master, debian/stretch-backports, master, proxy-ticket, upstream
Children:
f1147b6
Parents:
ac3f500
Message:

Compatibility code for GCC version < 5

The builtin_add_overflow() which is used for safe integer type
conversion was introduced with GCC 5, and thus unfortunately is not
available in Debian stable.

The "!defined(clang)" part in the version check is because Clang
3.8 has the builtin, but pretends to be GCC 4 as far as the GNUC
macro is concerned.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gnutls_util.c

    rac3f500 ref06c74  
    112112    apr_file_close(file);
    113113
    114     /* safe integer type conversion */
     114    /* safe integer type conversion: unsigned int and apr_size_t might
     115     * have different sizes */
     116#if defined(__GNUC__) && __GNUC__ < 5 && !defined(__clang__)
     117    if (__builtin_expect(br > UINT_MAX, 0))
     118        return APR_EINVAL;
     119    else
     120        datum->size = (unsigned int) br;
     121#else
    115122    if (__builtin_add_overflow(br, 0, &datum->size))
    116123        return APR_EINVAL;
     124#endif
    117125
    118126    return rv;
Note: See TracChangeset for help on using the changeset viewer.