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

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Apr 8 04:25:30 PDT 2023


Mordante added a comment.

Do you have a way to reproduce the original bug? I'm a bit curious how this fixes it.



================
Comment at: libcxx/include/sstream:475
     {
         typename string_type::size_type __sz = __str_.size();
         __hm_ = const_cast<char_type*>(__str_.data()) + __sz;
----------------
This type is most likely `std::size_t`, and `__pbump` takes a `streamsize` which is signed. Why is this overflow save?


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