jbboehr / php-mustache

Mustache PHP Extension
MIT License
56 stars 22 forks source link

Segfault on Fedora 28 #49

Closed remicollet closed 6 years ago

remicollet commented 6 years ago

Build + test suite is OK on fedora <= 27 and RHEL, but on most recent Fedora 28:

TEST 12/190 [tests/MustacheCode__toReadableString.phpt]
========DIFF========
001+ Termsig=6
001- string(287) "Symbol 000 @ 012
002- Symbol 001 @ 022
003- S012:      0x02 FUNCTION 0
004- F015: 000: 0x11 DLOOKUPSYM 1
005- F018: 001: 0x18 DPRINTE
006- F019: 002: 0x10 DPOP
007- F020: 003: 0x08 RETURN
008- N021:      0x00
009- S022:      0x03 STRING 1
010- C025: 000: 0x74 t
011- C026: 001: 0x65 e
012- C027: 002: 0x73 s
013- C028: 003: 0x74 t
014- N029:      0x00
015- "
========DONE========

I will try to investigate this issue, probably related to some new security enforcement build options

remicollet commented 6 years ago
(gdb) bt
#0  0x00007ffff47daf2b in raise () from /lib64/libc.so.6
#1  0x00007ffff47c5561 in abort () from /lib64/libc.so.6
#2  0x00007fffe6c06628 in std::__replacement_assert(char const*, int, char const*, char const*) () from /lib64/libmustache.so.4
#3  0x00007fffe6c0ce8f in mustache::CompilerState::next(unsigned char*, unsigned short*) () from /lib64/libmustache.so.4
#4  0x00007fffe6c0d176 in mustache::Compiler::print[abi:cxx11](std::vector<unsigned char, std::allocator<unsigned char> >*) () from /lib64/libmustache.so.4
#5  0x00007fffe6c0d31e in mustache::Compiler::print[abi:cxx11](unsigned char*, int) () from /lib64/libmustache.so.4
#6  0x00007fffe6e1fe00 in zim_MustacheCode_toReadableString () at /builddir/build/BUILD/php-pecl-mustache-0.7.4/NTS/mustache_code.cpp:102
#7  0x00005555558af554 in execute_ex ()
#8  0x00005555558b0546 in zend_execute ()
#9  0x00005555558098cb in zend_execute_scripts ()
#10 0x00005555557a5318 in php_execute_script ()
#11 0x00005555558b2b20 in do_cli ()
#12 0x000055555565f0a2 in main ()

So I think the issue is in libmustache... or GCC 8

jbboehr commented 6 years ago

@remicollet Thanks for letting me know. There are two implementations in libmustache: a simple interpreter that uses the mustache AST, and a compiler and virtual machine. Unfortunately, my VM implementation turned out to not be significantly faster which I suspect is due to the relative simplicity of the language and most of the time being spent doing map lookups, etc. I believe I might deprecate it.

remicollet commented 5 years ago

Would it be possible to release a new version ?

libmustache 0.5.0 is released, but of course, this extension cannot be build against it.