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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jille at hexon dot cx
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed Mar 12 04:01:30 2025 UTC