php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59224 [PATCH] FFI Ref sample PHP crash (fixed)
Submitted: 2010-05-20 13:23 UTC Modified: 2017-04-01 20:11 UTC
From: tpruvot@php.net Assigned:
Status: Wont fix Package: ffi (PECL)
PHP Version: 5.2.13 OS: Windows (All)
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2010-05-20 13:23 UTC] tpruvot@php.net
Description:
------------
Here is the bug fix for Win32/64

Index: ffi_library.c
============================================================
=======
--- ffi_library.c	(r?vision 299526)
+++ ffi_library.c	(copie de travail)
@@ -395,12 +395,22 @@
 	return func;
 }
 
-static union _zend_function *php_ffi_method_get(zval 
*object, char *name, int len TSRMLS_DC)
+static union _zend_function *php_ffi_method_get(
+#if PHP_API_VERSION >= 20041225
+	zval **object_pp,
+#else
+	zval *object,
+#endif
+char *name, int len TSRMLS_DC)
 {
 	zend_internal_function *f;
 	php_ffi_context *obj;
 	php_ffi_function *func;
-	
+
+#if PHP_API_VERSION >= 20041225
+	zval *object = *object_pp;
+#endif
+
 	obj = CTX_FETCH(object);
 
 	func = bind_func(obj, name, len TSRMLS_CC);

Reproduce code:
---------------
<?php

$win32_idl="
[lib='kernel32.dll'] DWORD GetTickCount();
";
$ffi = new ffi($win32_idl);
$count = $ffi->GetTickCount();

echo "$count";
?>

Expected result:
----------------
some dword value

Actual result:
--------------
[notice] EACCELERATOR(5760): PHP crashed on opline 15 at 
...test.php:6

[Thu May 20 19:06:58 2010] [crit] Parent: child process exited 
with status 3 -- Aborting.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-08-01 19:57 UTC] wez@php.net
Fix applied in:

http://svn.php.net/viewvc?view=revision&revision=301773

I'm unable to test this (I don't have a Windows build 
environment handy at the moment); if this works for you, 
please feel free to close the ticket.

Thanks!
 [2017-04-01 20:11 UTC] tpunt@php.net
-Status: Open +Status: Wont fix
 [2017-04-01 20:11 UTC] tpunt@php.net
Due to this extension not seeing any activity since 2010, this issue will not be fixed. We are therefore closing this now.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 13:01:30 2024 UTC