Review Request 126854: Prevent crash when destroying Parser for ruby file with inrecoverable errors

Daniel Vrátil dvratil at kde.org
Sat Jan 23 18:05:19 UTC 2016


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/126854/
-----------------------------------------------------------

Review request for KDevelop.


Repository: kdev-ruby


Description
-------

When `rb_compile_file()` in `Parser` fails to build the AST for a file (e.g. due to wrong syntax), `Parser::parse()` aborts and return a nullptr, but the `ast` member variable remains initialized to an invalid pointer (from `ast_t::tree`). When the `Parser` is destroyed later, it hits SIGSEGV, because `free_ast` tries to free an invalid pointer.


Diffs
-----

  parser/parser.cpp 67e35d9 

Diff: https://git.reviewboard.kde.org/r/126854/diff/


Testing
-------

No more crashes when opening an invalid Ruby file.


Thanks,

Daniel Vrátil

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20160123/1e60f740/attachment.html>


More information about the KDevelop-devel mailing list