|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77632 FFI Segfaults When Called With Variadics
Submitted: 2019-02-18 10:31 UTC Modified: 2019-02-18 10:38 UTC
From: Assigned: dmitry (profile)
Status: Closed Package: *Extensibility Functions
PHP Version: Next Minor Version OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2019-02-18 10:31 UTC]
FFI causes a segfault if called with variadics.

Test script:

$libc = FFI::cdef("int printf(const char *format, ...);", "");
$args = ["test"];

Expected result:

Actual result:
Segmentation fault:

Program received signal SIGSEGV, Segmentation fault.
0x0000555555b0826a in zend_check_arg_send_type (zf=0x55555659b710 <executor_globals+1296>, arg_num=0, mask=3) at Zend/zend_compile.h:943
943             return UNEXPECTED((zf->common.arg_info[arg_num].pass_by_reference & mask) != 0);


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-02-18 10:38 UTC]
-Assigned To: +Assigned To: dmitry
 [2019-02-18 15:12 UTC]
Automatic comment on behalf of
Log: Fixed bug #77632 (FFI Segfaults When Called With Variadics)
 [2019-02-18 15:12 UTC]
-Status: Assigned +Status: Closed
 [2020-11-17 13:07 UTC] ricardo dot cescon at panthermedia dot net
I still have a problem with PHP 7.4.12

int vips_image_write_to_file(VipsImage *image, const char *name, ...);
 => segmentation fault

int vips_image_write_to_file(VipsImage *image, const char *name);
 => no segmentation fault, but function not useable :-(
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Nov 30 21:01:23 2020 UTC