php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74962 protobuf extension bug
Submitted: 2017-07-21 09:42 UTC Modified: 2017-07-21 11:36 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: roczpwu at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 7.1.7 OS: mac osx
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: roczpwu at gmail dot com
New email:
PHP Version: OS:

 

 [2017-07-21 09:42 UTC] roczpwu at gmail dot com
Description:
------------
I generate php files using my pro file, when I invoke serializeToString method, Segment fault: 11 error occurred.

Test script:
---------------
proto file:
syntax = "proto3";
package com;
message A
{
    string str = 1;
}
message B
{
    A a = 307001;
    string json_body_req = 308000;
}

===================================
php test file:
<?php
$b = new \Com\B();
$a = new \Com\A();
$a->setStr("hello");
$b->setJsonBodyReq("world");
$b->setA($a);
$str = $b->serializeToString();

$b = new \Com\B();
$b->mergeFromString($str);
var_dump($b->getA()->getStr());

Expected result:
----------------
string(5) "hello"

Actual result:
--------------
Segmentation fault: 11

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-21 09:57 UTC] requinix@php.net
-Status: Open +Status: Feedback -Package: PHP Language Specification +Package: *General Issues
 [2017-07-21 09:57 UTC] requinix@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.


 [2017-07-21 11:14 UTC] roczpwu at gmail dot com
-Status: Feedback +Status: Open
 [2017-07-21 11:14 UTC] roczpwu at gmail dot com
backtrace is shown as below:

additionaly, protobuf extension version is 3.3.2
=================================================

Core was generated by `php Client.php'.
Program terminated with signal 11, Segmentation fault.
#0  stringdata_handler (closure=0x600000002, hd=0x322d2f0,
    str=0x7efe59462419 "hello", len=5, handle=0x7fff883d3820)
    at /root/protobuf-3.3.2/encode_decode.c:325
325	/root/protobuf-3.3.2/encode_decode.c: No such file or directory.
Missing separate debuginfos, use: debuginfo-install cyrus-sasl-lib-2.1.26-20.el7_2.x86_64 glibc-2.17-157.el7_3.5.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.14.1-27.el7_3.x86_64 libcom_err-1.42.9-9.el7.x86_64 libcurl-7.29.0-35.el7.centos.x86_64 libidn-1.28-4.el7.x86_64 libjpeg-turbo-1.2.90-5.el7.x86_64 libmcrypt-2.5.8-13.el7.x86_64 libpng-1.5.13-7.el7_2.x86_64 libselinux-2.5-6.el7.x86_64 libssh2-1.4.3-10.el7_2.1.x86_64 libxml2-2.9.1-6.el7_2.3.x86_64 nspr-4.13.1-1.0.el7_3.x86_64 nss-3.28.4-1.2.el7_3.x86_64 nss-softokn-freebl-3.16.2.3-14.4.el7.x86_64 nss-util-3.28.4-1.0.el7_3.x86_64 openssl-libs-1.0.1e-60.el7_3.1.x86_64 pcre-8.32-15.el7_2.1.x86_64 xz-libs-5.2.2-1.el7.x86_64 zlib-1.2.7-17.el7.x86_64
 [2017-07-21 11:36 UTC] roczpwu at gmail dot com
Core was generated by `php Client.php'.
Program terminated with signal 11, Segmentation fault.
#0  stringdata_handler (closure=0x600000002, hd=0x322d2f0,
    str=0x7efe59462419 "hello", len=5, handle=0x7fff883d3820)
    at /root/protobuf-3.3.2/encode_decode.c:325
325	/root/protobuf-3.3.2/encode_decode.c: No such file or directory.
Missing separate debuginfos, use: debuginfo-install cyrus-sasl-lib-2.1.26-20.el7_2.x86_64 glibc-2.17-157.el7_3.5.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.14.1-27.el7_3.x86_64 libcom_err-1.42.9-9.el7.x86_64 libcurl-7.29.0-35.el7.centos.x86_64 libidn-1.28-4.el7.x86_64 libjpeg-turbo-1.2.90-5.el7.x86_64 libmcrypt-2.5.8-13.el7.x86_64 libpng-1.5.13-7.el7_2.x86_64 libselinux-2.5-6.el7.x86_64 libssh2-1.4.3-10.el7_2.1.x86_64 libxml2-2.9.1-6.el7_2.3.x86_64 nspr-4.13.1-1.0.el7_3.x86_64 nss-3.28.4-1.2.el7_3.x86_64 nss-softokn-freebl-3.16.2.3-14.4.el7.x86_64 nss-util-3.28.4-1.0.el7_3.x86_64 openssl-libs-1.0.1e-60.el7_3.1.x86_64 pcre-8.32-15.el7_2.1.x86_64 xz-libs-5.2.2-1.el7.x86_64 zlib-1.2.7-17.el7.x86_64
(gdb) bt
#0  stringdata_handler (closure=0x600000002, hd=0x322d2f0,
    str=0x7efe59462419 "hello", len=5, handle=0x7fff883d3820)
    at /root/protobuf-3.3.2/encode_decode.c:325
#1  0x00007efe58ec4cc7 in upb_sink_putstring (handle=0x7fff883d3820, n=5,
    buf=<optimized out>, sel=2, s=<optimized out>)
    at /root/protobuf-3.3.2/upb.h:6285
#2  run_decoder_vm (d=0x7fff883d3908, group=<optimized out>, handle=0x7fff883d3820)
    at /root/protobuf-3.3.2/upb.c:9942
#3  0x00007efe58eb6b86 in upb_bytessink_putbuf (s=0x7fff883d3910,
    handle=0x7fff883d3820, size=22,
    buf=0x7efe59462408 "\202\262\226\001\005world\312\363\225\001\a\n\005hello",
    subc=<optimized out>) at /root/protobuf-3.3.2/upb.h:6228
#4  upb_bufsrc_putbuf (
    buf=0x7efe59462408 "\202\262\226\001\005world\312\363\225\001\a\n\005hello",
    len=22, sink=0x7fff883d3910) at /root/protobuf-3.3.2/upb.c:5106
#5  0x00007efe58ead8f1 in zim_Message_mergeFromString (
    execute_data=<optimized out>, return_value=<optimized out>)
    at /root/protobuf-3.3.2/encode_decode.c:1449
#6  0x000000000089a696 in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER ()
    at /root/php-7.1.7/Zend/zend_vm_execute.h:970
#7  0x000000000084930b in execute_ex (ex=<optimized out>)
    at /root/php-7.1.7/Zend/zend_vm_execute.h:429
#8  0x000000000089c3f4 in zend_execute (op_array=0x7efe59480000,
    op_array@entry=0x7efe59463ae0, return_value=return_value@entry=0x7efe59413030)
    at /root/php-7.1.7/Zend/zend_vm_execute.h:474
#9  0x00000000008045a4 in zend_execute_scripts (type=type@entry=8,
    retval=0x7efe59413030, retval@entry=0x0, file_count=file_count@entry=3)
    at /root/php-7.1.7/Zend/zend.c:1476
#10 0x00000000007a56f0 in php_execute_script (
    primary_file=primary_file@entry=0x7fff883d6d50)
    at /root/php-7.1.7/main/main.c:2537
#11 0x000000000089e58f in do_cli (argc=2, argv=0x306dae0)
    at /root/php-7.1.7/sapi/cli/php_cli.c:993
#12 0x000000000043cea0 in main (argc=2, argv=0x306dae0)
    at /root/php-7.1.7/sapi/cli/php_cli.c:1381
(gdb) source /root/php-7.1.7/.gdbinit
(gdb) zbacktrace
[0x7efe59413260] Google\Protobuf\Internal\Message->mergeFromString("\37777777602\37777777662\37777777626\1\5world\37777777712\37777777763\37777777625\1\7\12\5hello") [internal function]
[0x7efe59413030] (main) /root/test/tsf2.0/App/Udp/Client.php:26
(gdb)
 [2017-07-21 11:36 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2017-07-21 11:36 UTC] requinix@php.net
We do not maintain the protobuf library.

https://github.com/google/protobuf/issues
Look for any existing bug reports that match your problem, and if you can't find one then report it there. If Google says the bug is in PHP then we can reopen this.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 12:01:31 2024 UTC