Invalid std::basic_string handling of big CharTs

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

As you mentioned, this is fixed in libc++ 7.0. It was PR31454 and was fixed by commit r324531.

AFAIK we’re not doing dot releases on LLVM 6 anymore, so I don’t think there is anything to do.

/Eric

I was already told as much, thanks. I failed to find the bug for it before.

Regards,
Přemysl Janouch