[Lldb-commits] [lldb] r316740 - Fix a use-after-free in lldb-server

Davide Italiano via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 31 09:42:05 PDT 2017


On Tue, Oct 31, 2017 at 8:59 AM, Greg Clayton via lldb-commits
<lldb-commits at lists.llvm.org> wrote:
> My takeaway is a bug was added that wasn't previously a bug. If code was
> designed to carefully use StringRef, then yes, it can be made safe. But we
> added StringRef support in all of LLDB and we didn't catch all of the
> possible misuses. My main questions is: is there anything we can do to catch
> these things now that we have them.
>

FWIW, I'd say this is not necessarily a bad thing (the bug).
You can now try to write a test that catches this behaviour and/or run
an ASAN bot if there's a test already in case somebody breaks this
code.

Also, just to mention, this happen{s, ed} in LLVM many times, people
just revert the revision or fix immediately.
That's why we have bot and tests for. We shouldn't be really afraid of
using a variant of a standardized (!) function because it can break.
If people are judicious, then the problem will be fixed. If they're
not, the revision will be reverted.
I think the main takeaway from this test is lack of testing/infra, but
I'm not necessarily sure it's fair to pick on this commit because it
"added a bug".
We all know it could've happened regardless.

Thanks,

--
Davide


More information about the lldb-commits mailing list