[Lldb-commits] [PATCH] D32421: Fix segfault resulting from empty print prompt

Alex Langford via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed May 3 00:13:30 PDT 2017

xiaobai added a comment.

Over the weekend I dug into this further. It looks like the environment I found this bug in didn't have C++11 support and was using `std::string::length()`, which tries to perform a memory read where it's not supposed to, resulting in a segfault.
On my friend's Ubuntu server, it used `std::basic_string::length()` (since I had C++11 support). By sheer luck, `std::basic_string::length()` read a memory location that was indeed mapped but contained unrelated data. This isn't a breaking behavior since we use the result mod 80 to calculate `toColumn`, and immediately after the `MoveCursor` call we `fprintf("\n")`. I still think this is an issue.

As for the pexpect test, I tried to make it as simple as possible while maintaining the general style/feel of the test you suggested I look at. It passes when I run it with `dotest.py`, but I'm not sure if it should do more. I'm interested to see what you think.


More information about the lldb-commits mailing list