[gnutls-devel] libtasn1 | Fix handling of code which uses NULL pointers + offset (fixes issue #30) (!71)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Wed Feb 3 07:46:16 CET 2021




Stefan Weil commented:


clang may handle the undefined expression (NULL + offset) as NULL. Compile this test program with `-O2` and run it with and without an argument:

    #include <stdio.h>
    
    int main(int argc, char *argv[]) {
      char *p = argv[1] + argc;
      if (p != NULL) {
        printf("%p+%d => %p (%c)\n", argv[1], argc, p, *p);
      } else {
        printf("%p+%d => NULL\n", argv[1], argc);
      }
      return 0;
    }

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/libtasn1/-/merge_requests/71#note_500136125
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20210203/babcf631/attachment.html>


More information about the Gnutls-devel mailing list