Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DocParse: Segfault if some property don't have setter or getter #164

Closed
CrazyHackGUT opened this issue Dec 18, 2017 · 1 comment
Closed

Comments

@CrazyHackGUT
Copy link
Contributor

CrazyHackGUT commented Dec 18, 2017

I found interesting behavior in the file parser.
If i try parse file with methodmaps with properties with setters/getters (datapack.inc for example), or without properies (regex.inc), he works correctly.

kruzya@UBUNTU:~/alliedmodders/sourcemod/sourcepawn/build/exp/tools/docparse/docparse$ ./docparse ~/alliedmodders/sourcemod/plugins/include/datapack.inc 2>&1 > /dev/null
kruzya@UBUNTU:~/alliedmodders/sourcemod/sourcepawn/build/exp/tools/docparse/docparse$ echo $?
0
kruzya@UBUNTU:~/alliedmodders/sourcemod/sourcepawn/build/exp/tools/docparse/docparse$ ./docparse ~/alliedmodders/sourcemod/plugins/include/regex.inc 2>&1 > /dev/null
kruzya@UBUNTU:~/alliedmodders/sourcemod/sourcepawn/build/exp/tools/docparse/docparse$ echo $?
0

But if i try parse file with property without getter/setter (admin.inc and AdminId.GroupCount / GroupId.GroupImmunitiesCount), i receive segfault...

kruzya@UBUNTU:~/alliedmodders/sourcemod/sourcepawn/build/exp/tools/docparse/docparse$ ./docparse ~/alliedmodders/sourcemod/plugins/include/admin.inc 2>&1 > /dev/null
Segmentation fault (core dumped)
kruzya@UBUNTU:~/alliedmodders/sourcemod/sourcepawn/build/exp/tools/docparse/docparse$ echo $?
139

P.S.: Sorry for my english. I'm from Russia.

@CrazyHackGUT
Copy link
Contributor Author

CrazyHackGUT commented Dec 18, 2017

GDB output for file without property setter:

(gdb) run
Starting program: /home/kruzya/alliedmodders/sourcemod/sourcepawn/build/exp/tools/docparse/docparse/docparse /home/kruzya/alliedmodders/sourcemod/plugins/include/admin.inc
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x0804a1f8 in sp::FunctionNode::signature (this=0x0)
    at /home/kruzya/alliedmodders/sourcemod/sourcepawn/exp/compiler/ast.h:1091
1091        return signature_;
(gdb) bt
#0  0x0804a1f8 in sp::FunctionNode::signature (this=0x0)
    at /home/kruzya/alliedmodders/sourcemod/sourcepawn/exp/compiler/ast.h:1091
#1  0x08051965 in sp::NameResolver::LeavePropertyDecl (this=0xffffd2b4, decl=0x80c0628)
    at /home/kruzya/alliedmodders/sourcemod/sourcepawn/exp/compiler/name-resolver.cpp:532
#2  0x0805ade0 in sp::Parser::parseAccessor (this=0xffffd28c)
    at /home/kruzya/alliedmodders/sourcemod/sourcepawn/exp/compiler/parser.cpp:1287
#3  0x0805b2c3 in sp::Parser::methodmap (this=0xffffd28c, kind=sp::TOK_METHODMAP)
    at /home/kruzya/alliedmodders/sourcemod/sourcepawn/exp/compiler/parser.cpp:1376
#4  0x0805d68e in sp::Parser::parse (this=0xffffd28c)
    at /home/kruzya/alliedmodders/sourcemod/sourcepawn/exp/compiler/parser.cpp:2237
#5  0x08048fd7 in Run (cc=...,
    path=0xffffd85e "/home/kruzya/alliedmodders/sourcemod/plugins/include/admin.inc")
    at /home/kruzya/alliedmodders/sourcemod/sourcepawn/exp/tools/docparse/docparse.cpp:430
#6  0x08049197 in main (argc=2, argv=0xffffd6e4)
    at /home/kruzya/alliedmodders/sourcemod/sourcepawn/exp/tools/docparse/docparse.cpp:458

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants