[libcxx-commits] [PATCH] D146294: [libcxx] Fix crash in std::stringstream with payload >= INT_MAX

Azat Khuzhin via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Apr 9 08:16:04 PDT 2023


azat added a comment.

@Mordante

> Do you have a way to reproduce the original bug?

Yes sure, you can look at the test, without this patch it will SIGSEGV or something

> I'm a bit curious how this fixes it.

The problem was that gcount() reinitialize some internal fields, but it works only for INT_MAX not more, since it uses `pbump(int)` over `__pbump(streamsize)`, which leaves the `__nout_` in invalid state (overflowed int).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146294/new/

https://reviews.llvm.org/D146294



More information about the libcxx-commits mailing list