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

Daniel Vrátil dvratil at kde.org
Sun Jan 24 15:16:47 UTC 2016


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

(Updated Jan. 24, 2016, 5:16 p.m.)


Status
------

This change has been marked as submitted.


Review request for KDevelop.


Changes
-------

Submitted with commit ed4ad738c8ef23c04f76f9ad90b1283b2e5c3529 by Daniel Vrátil to branch 5.0.


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/20160124/d61534a3/attachment-0001.html>


More information about the KDevelop-devel mailing list