php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59766 Calling _set, _base_set, _set (again) and _add segfaults
Submitted: 2011-05-13 11:36 UTC Modified: 2011-05-17 15:04 UTC
From: jille at hexon dot cx Assigned:
Status: Closed Package: libevent (PECL)
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
34 + 31 = ?
Subscribe to this entry?

 
 [2011-05-13 11:36 UTC] jille at hexon dot cx
Description:
------------
event_set() resets which base the event belongs to. The extension does not register that and libevent will segfault.

Reproduce code:
---------------
<?php
  $ev = event_new();
  event_set($ev, udp_getSocket(), EV_READ, function() { });
  $base = event_base_new();  
  event_base_set($ev, $base);
  event_set($ev, udp_getSocket(), EV_READ | EV_WRITE, function() { });
  event_add($ev);
?>

Actual result:
--------------
Segmentation fault in event_add().

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-05-16 10:26 UTC] jille at hexon dot cx
It gets worse: When I got notified I there was data in my (own) write-buffer I tried:
  event_del($ev);
  event_set(..., EV_READ | EV_WRITE | EV_PERSIST, ...);
  event_base_set($ev, $base);
  event_add($ev);

but that segfaults somewhere in event_add() too. (I guess in the handlers add()-function, but I can't confirm that for sure with gdb)

Calling event_set() after using some event seems to be not-done.
 [2011-05-17 15:04 UTC] tony at daylessday dot org
This bug has been fixed in SVN.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 14:01:30 2024 UTC