aboutsummaryrefslogtreecommitdiff
path: root/lib/libcxx/src/ios.cpp
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2024-08-23 02:59:46 +0200
committerAndrew Kelley <andrew@ziglang.org>2024-09-19 18:20:21 -0700
commit1c8f0b8909f342201f84def1efb8c6fb4386cc2c (patch)
treeb58a1488ff85440a65565474627add3fdc66b32e /lib/libcxx/src/ios.cpp
parentd13bc04cb4c4c2f0806b9d9c676cb013ea888828 (diff)
downloadzig-1c8f0b8909f342201f84def1efb8c6fb4386cc2c.tar.gz
zig-1c8f0b8909f342201f84def1efb8c6fb4386cc2c.zip
libcxx: Update to LLVM 19.
* Moved the tz.cpp patch to experimental/tzdb.cpp. * Extended the __config_site patch to a few more files.
Diffstat (limited to 'lib/libcxx/src/ios.cpp')
-rw-r--r--lib/libcxx/src/ios.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libcxx/src/ios.cpp b/lib/libcxx/src/ios.cpp
index d58827fa12..a727855c46 100644
--- a/lib/libcxx/src/ios.cpp
+++ b/lib/libcxx/src/ios.cpp
@@ -195,6 +195,10 @@ void ios_base::register_callback(event_callback fn, int index) {
}
ios_base::~ios_base() {
+ // Avoid UB when not properly initialized. See ios_base::ios_base for
+ // more information.
+ if (!__loc_)
+ return;
__call_callbacks(erase_event);
locale& loc_storage = *reinterpret_cast<locale*>(&__loc_);
loc_storage.~locale();