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

insights crashed on some invalid inputs #51

Closed
adromanov opened this issue Jul 19, 2018 · 3 comments
Closed

insights crashed on some invalid inputs #51

adromanov opened this issue Jul 19, 2018 · 3 comments

Comments

@adromanov
Copy link

adromanov commented Jul 19, 2018

Crashed on the following piece of code:

#include <map>

int main()
// no open curly bracket here
    using Map = std::map<int, bool>;
    Map m;
    auto [it, ok] = m.insert({1, true});
}

Output is:

/home/insights/insights.cpp:5:5: error: expected function body after function declarator
    using Map = std::map<int, bool>;
    ^
/home/insights/insights.cpp:6:4: error: unknown type name 'Map'
        Map m;
        ^
/home/insights/insights.cpp:8:1: error: extraneous closing brace ('}')
}
^
[0x129475a]
....
[0x4a4407]
Segmentation fault (core dumped)

Without line

auto [it, ok] = m.insert({1, true});

there is no crash, just errors reported.

@andreasfertig
Copy link
Owner

Hello,

that's interesting. While I see the crash online, I cannot confirm it on my machine. I need to have a deeper look into it. Although, invalid code will not give a good result so its not on top of my priority list.

@adromanov
Copy link
Author

Your local machine is on OS X, right? My is on linux and I can see a crash locally. Latest llvm+clang built with gcc-8.1.0.

@andreasfertig
Copy link
Owner

Thanks for your spec. It's correct I use OS X. I will fire up a docker container and see what's happening there. There is a chance that it is a bug which is also reachable in a different (compiling) context.

andreasfertig pushed a commit that referenced this issue Jul 20, 2018
A missing brace in main leads insights to a crash. While the program is
invalid, the reason for the crash was a nullptr in FindDeclRef which
potentially can occur with valid code as well. The fix handles the case
that stmt is a nullptr.
andreasfertig pushed a commit that referenced this issue Jul 20, 2018
A missing brace in main leads insights to a crash. While the program is
invalid, the reason for the crash was a nullptr in FindDeclRef which
potentially can occur with valid code as well. The fix handles the case
that stmt is a nullptr.
andreasfertig pushed a commit that referenced this issue Jul 20, 2018
Fixed issue #51: Crash of insights with invalid code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants