[libcxx-commits] [PATCH] D57761: [libc++] Avoid UB in the no-exceptions mode in a few places

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 5 09:19:25 PST 2019


ldionne created this revision.
ldionne added a reviewer: mclow.lists.
Herald added a reviewer: EricWF.
Herald added subscribers: libcxx-commits, dexonsmith, jkorous, christof.

A few places in the library seem to behave unexpectedly when the library
is compiled or used with exceptions disabled. For example, not throwing
an exception when a pointer is NULL can lead us to dereference the pointer
later on, which is UB. This patch fixes such occurences.

It's hard to tell whether there are other places where the no-exceptions
mode misbehaves like this, because the replacement for throwing an
exception does not always seem to be abort()ing, but at least this
patch will improve the situation somewhat.

See http://lists.llvm.org/pipermail/libcxx-dev/2019-January/000172.html


Repository:
  rCXX libc++

https://reviews.llvm.org/D57761

Files:
  libcxx/include/ios
  libcxx/include/unordered_map
  libcxx/src/hash.cpp
  libcxx/src/ios.cpp
  libcxx/src/locale.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57761.185328.patch
Type: text/x-patch
Size: 5475 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190205/fbefce2b/attachment.bin>


More information about the libcxx-commits mailing list