php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69904 ???
Submitted: 2015-06-22 19:48 UTC Modified: 2015-06-23 20:21 UTC
From: gamelaster at outlook dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.6.10 OS: Linux Debian Jessie
Private report: No CVE-ID: None
 [2015-06-22 19:48 UTC] gamelaster at outlook dot com
Description:
------------
Good day,

first, this is a first forum where i though i can write my trouble, so if im wrong, + move or delete. Thanks

To topic, i trying to run a (relative) old DBUS library for PHP (https://github.com/GAMELASTER/php-dbus - my fork and upgrade for success building) and SkypePHP library (https://github.com/fujimoto/php-skype). I successfully fixed a DBUS (just trivial forgot of rename) and builded. When i execute skype_bot.php from console as root, its little work but then PHP throw Segmentation fault. Im not a newbie in programming and linux, but with c++ and linux building-debugging i dont have some skills. But i gets a GDB dump and found the root of trouble. 


So trouble is in zend_hash_find... As i said, i dont have so much experiences but... :-) I tryied to print a zv, key, element, on_error ... But i dont knowed the values of zend_hash_find so i cant fprintf (my low skills in C++). So, what to do now?

Thanks

P.S. If im fully wrong, where i can ask to this problem? (I tryied ask a author of PHP DBUS but he is inactive... :/ )

Test script:
---------------
#define   dbus_objprop_get(zv, key, element, on_error) { \
   fprintf(stderr, "execute dbus_objprop_get\n");\
   if (zend_hash_find(Z_OBJPROP(zv), key, strlen(key)+1, (void**)&element) != SUCCESS) { \
      fprintf(stderr, "all good\n");\
      php_error_docref(NULL TSRMLS_CC, E_WARNING, "property [%s] is not set", key); \
      fprintf(stderr, "good2\n");\
      element = NULL; \
      on_error; \
   } \
}

/* {{{ _dbus_message_resource */
static DBusMessage* _dbus_message_resource(zval *obj TSRMLS_DC) {
   zval **tmp;
   int resource_type;
   
   if (obj == NULL) {
      return NULL;
   }
   dbus_objprop_get(*obj, "message", tmp, 0); // line 308
   if (tmp == NULL) {
      return NULL;
   }
   void *message = (void*)zend_list_find(Z_LVAL_PP(tmp), &resource_type);
   if (message == NULL || resource_type != le_dbus_message) {
      php_error_docref(NULL TSRMLS_CC, E_WARNING, "message identifier not found");
      return NULL;
   }

   return message;
}

Expected result:
----------------
just work

Actual result:
--------------
GDB pastebins

http://pastebin.com/aXnumw74
http://pastebin.com/kWsKkipV

Segmentation Fault

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-23 20:21 UTC] kalle@php.net
-Status: Open +Status: Not a bug
 [2015-06-23 20:21 UTC] kalle@php.net
Hi!

This is not a support forum, just for pure bug reporting, but fear not! You should be able to find some internals support help on channels like #php.pecl on EFNet (IRC) or our mailing lists internals@ or pecl-dev@ (see http://php.net/mailinglists)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 01 07:01:30 2024 UTC