[PATCH] D32670: Ensure showbase does not overflow do_put buffers

Dimitry Andric via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 29 07:17:35 PDT 2017


dim created this revision.
Herald added a subscriber: emaste.

In https://bugs.freebsd.org/207918, Daniel McRobb describes how using
std::showbase with ostreams can cause truncation of unsigned long long
when output format is octal.  In fact, this can even happen with
unsigned int and unsigned long.

To ensure this does not happen, add one additional character to the
do_put buffers if std::showbase is on.  Also add a test case.


https://reviews.llvm.org/D32670

Files:
  include/locale
  test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minmax_showbase.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32670.97192.patch
Type: text/x-patch
Size: 6544 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170429/c6e751d1/attachment.bin>


More information about the cfe-commits mailing list