[libcxx-dev] Invalid std::basic_string handling of big CharTs

Přemysl Janouch via libcxx-dev libcxx-dev at lists.llvm.org
Sat Nov 3 08:35:20 PDT 2018


Hey,
rather minimal reproducer on at least clang++ & libc++ 3.5 upto 6.0:

  #include <string>

  struct big { int bloat[4]; };
  using big_string = std::basic_string<big>;

  int main () {
    big_string a;
    for (int i = 0; i < 100; i++)
      a += big {};
    return 0;
  }

$ clang++ -stdlib=libc++ reproducer.cpp
$ valgrind ./a.out

Lots of invalid writes, in practice causes segmentation faults.

Thanks in advance for fixing.  The use case was ncurses' cchar_t.

Regards,
Přemysl Janouch




More information about the libcxx-dev mailing list