[llvm-bugs] [Bug 38657] Test using strcmp fails after r339410

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 21 10:48:50 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38657

Eli Friedman <efriedma at codeaurora.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|REOPENED                    |RESOLVED

--- Comment #8 from Eli Friedman <efriedma at codeaurora.org> ---
Yes, still a use-after-free.  There are a few easy ways to verify this. One, it
crashes if you change "struct String" to allocate storage on the heap, e.g.:

struct String {
  char  *content;
  String (const String& a) {
    content = new char[1000000];
    strcpy(content, a.content);
  }
  String (const char* a) {
    content = new char[1000000];
    strcpy(content, a);
  }
  operator const char* () const {
    return content;
  }
  ~String() { delete content; }
};

Two, if you build with -fsanitize=address, you'll get a "stack-use-after-scope"
error.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180821/84bbd76a/attachment-0001.html>


More information about the llvm-bugs mailing list