[libcxx-commits] [PATCH] D113600: [libc++] Fix segmentation fault in __do_put_integral

Marco Falke via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Nov 10 11:51:55 PST 2021


MarcoFalke created this revision.
MarcoFalke added reviewers: ldionne, libc++.
MarcoFalke added a project: libc++.
MarcoFalke requested review of this revision.
Herald added 1 blocking reviewer(s): libc++.

6 chars are not sufficient to represent all formats for 64 bit integers.

This was accidentally introduced in commit b889cbf36635a302f5b77560f1769178f196c2c7 <https://reviews.llvm.org/rGb889cbf36635a302f5b77560f1769178f196c2c7> (https://reviews.llvm.org/D112830).

This causes failures in downstream projects, for example:

- https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40817
- https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=40841


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113600

Files:
  libcxx/include/locale


Index: libcxx/include/locale
===================================================================
--- libcxx/include/locale
+++ libcxx/include/locale
@@ -1476,7 +1476,7 @@
                                                     char const* __len) const
 {
     // Stage 1 - Get number in narrow char
-    char __fmt[6] = {'%', 0};
+    char __fmt[8] = {'%', 0};
     this->__format_int(__fmt+1, __len, is_signed<_Integral>::value, __iob.flags());
     // Worst case is octal, with showbase enabled. Note that octal is always
     // printed as an unsigned value.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113600.386270.patch
Type: text/x-patch
Size: 559 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211110/e668d6a3/attachment-0001.bin>


More information about the libcxx-commits mailing list