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/   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:     Wmismatched-dealloc-3.c (5.07 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
/* Verify that Glibc <stdlib.h> declarations are handled correctly
   { dg-do compile }
   { dg-options "-Wall" } */

#define A(...) __attribute__ ((malloc (__VA_ARGS__), noipa))

typedef __SIZE_TYPE__ size_t;

/* All functions with the same standard deallocator are associated
   with each other.  */
void free (void*);
void* calloc (size_t, size_t);
void* malloc (size_t);
void* realloc (void*, size_t);

A (__builtin_free) void* aligned_alloc (size_t, size_t);

/* Like realloc(), reallocarray() is both an allocator and a deallocator.
   It must be associated with both free() and with itself, but nothing
   else.  */
A (__builtin_free) void* reallocarray (void*, size_t, size_t);
A (reallocarray) void* reallocarray (void*, size_t, size_t);

A (__builtin_free) extern char *canonicalize_file_name (const char*);


void dealloc (void*);
A (dealloc) void* alloc (size_t);


void sink (void*);
void* source (void);


void test_builtin_aligned_alloc (void *p)
{
  {
    void *q = __builtin_aligned_alloc (1, 2);
    sink (q);
    __builtin_free (q);
  }

  {
    void *q = __builtin_aligned_alloc (1, 2);
    sink (q);
    free (q);
  }

  {
    void *q = __builtin_aligned_alloc (1, 2);
    q = __builtin_realloc (q, 3);
    sink (q);
    free (q);
  }

  {
    void *q = __builtin_aligned_alloc (1, 2);
    q = realloc (q, 3);
    sink (q);
    free (q);
  }

  {
    void *q;
    q = __builtin_aligned_alloc (1, 2); // { dg-message "returned from '__builtin_aligned_alloc'" }
    sink (q);
    dealloc (q);                        // { dg-warning "'dealloc' called on pointer returned from a mismatched allocation function" }
  }
}


void test_aligned_alloc (void *p)
{
  {
    void *q = aligned_alloc (1, 2);
    sink (q);
    __builtin_free (q);
  }

  {
    void *q = aligned_alloc (1, 2);
    sink (q);
    free (q);
  }

  {
    void *q = aligned_alloc (1, 2);
    q = __builtin_realloc (q, 3);
    sink (q);
    free (q);
  }

  {
    void *q = aligned_alloc (1, 2);
    q = realloc (q, 3);
    sink (q);
    free (q);
  }

  {
    void *q = aligned_alloc (1, 2);     // { dg-message "returned from 'aligned_alloc'" }
    sink (q);
    dealloc (q);                        // { dg-warning "'dealloc' called on pointer returned from a mismatched allocation function" }
  }
}


void test_reallocarray (void *p)
{
  {
    void *q = __builtin_aligned_alloc (1, 2);
    q = reallocarray (q, 2, 3);
    sink (q);
    free (q);
  }

  {
    void *q = aligned_alloc (1, 2);
    q = reallocarray (q, 2, 3);
    sink (q);
    free (q);
  }

  {
    void *q = __builtin_calloc (1, 2);
    q = reallocarray (q, 2, 3);
    sink (q);
    free (q);
  }

  {
    void *q = calloc (1, 2);
    q = reallocarray (q, 2, 3);
    sink (q);
    free (q);
  }

  {
    void *q = __builtin_malloc (1);
    q = reallocarray (q, 2, 3);
    sink (q);
    free (q);
  }

  {
    void *q = malloc (1);
    q = reallocarray (q, 2, 3);
    sink (q);
    free (q);
  }

  {
    void *q = __builtin_realloc (p, 1);
    q = reallocarray (q, 2, 3);
    sink (q);
    free (q);
  }

  {
    p = source ();
    void *q = realloc (p, 1);
    q = reallocarray (q, 2, 3);
    sink (q);
    free (q);
  }

  {
    void *q = __builtin_strdup ("abc");
    q = reallocarray (q, 3, 4);
    sink (q);
    free (q);
  }

  {
    void *q = __builtin_strndup ("abcd", 3);
    q = reallocarray (q, 4, 5);
    sink (q);
    free (q);
  }

  {
    void *q = source ();
    q = reallocarray (q, 5, 6);
    sink (q);
    free (q);
  }

  {
    void *q = alloc (1);                // { dg-message "returned from 'alloc'" }
    q = reallocarray (q, 6, 7);         // { dg-warning "'reallocarray' called on pointer returned from a mismatched allocation function" }
    sink (q);
    free (q);
  }

  {
    p = source ();
    void *q = reallocarray (p, 7, 8);
    q = __builtin_realloc (q, 9);
    sink (q);
    free (q);
  }

  {
    p = source ();
    void *q = reallocarray (p, 7, 8);
    q = realloc (q, 9);
    sink (q);
    free (q);
  }

  {
    p = source ();
    void *q = reallocarray (p, 8, 9);
    q = reallocarray (q, 3, 4);
    sink (q);
    free (q);
  }

  {
    p = source ();
    void *q = reallocarray (p, 9, 10);
    q = reallocarray (q, 3, 4);
    sink (q);
    dealloc (q);                        // { dg-warning "'dealloc' called on pointer returned from a mismatched allocation function" }
  }
}


void test_canonicalize_filename (void *p)
{
  {
    void *q = canonicalize_file_name ("a");
    sink (q);
    __builtin_free (q);
  }

  {
    void *q = canonicalize_file_name ("b");
    sink (q);
    free (q);
  }

  {
    void *q = canonicalize_file_name ("c");
    q = __builtin_realloc (q, 2);
    sink (q);
    free (q);
  }

  {
    void *q = canonicalize_file_name ("d");
    q = realloc (q, 3);
    sink (q);
    free (q);
  }

  {
    void *q = canonicalize_file_name ("e");
    q = reallocarray (q, 4, 5);
    sink (q);
    free (q);
  }

  {
    void *q;
    q = canonicalize_file_name ("f");   // { dg-message "returned from 'canonicalize_file_name'" }
    sink (q);
    dealloc (q);                        // { dg-warning "'dealloc' called on pointer returned from a mismatched allocation function" }
  }
}

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.0061 ]--