summaryrefslogtreecommitdiffstats
path: root/libcxx
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2012-02-19 14:55:32 +0000
committerHoward Hinnant <hhinnant@apple.com>2012-02-19 14:55:32 +0000
commit7c24d8e70b8a00b72878a78b8ac490f26ef237de (patch)
tree8fb2eb22e59ec65f48f794b28d9bfcb3fecc5f0f /libcxx
parente6c32e6293adaff31d8fb436858459e53764332a (diff)
downloadbcm5719-llvm-7c24d8e70b8a00b72878a78b8ac490f26ef237de.tar.gz
bcm5719-llvm-7c24d8e70b8a00b72878a78b8ac490f26ef237de.zip
Initialize all the fields of struct tm before passing it to strftime. One of the uninitialized fields, probably the pointer field tm_zone, was causing a segfault on linux. Patch contributed by Jeffrey Yasskin.
llvm-svn: 150929
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/src/locale.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp
index 7f4068949fc..1b242f1206d 100644
--- a/libcxx/src/locale.cpp
+++ b/libcxx/src/locale.cpp
@@ -4551,7 +4551,7 @@ template <>
string
__time_get_storage<char>::__analyze(char fmt, const ctype<char>& ct)
{
- tm t;
+ tm t = {0};
t.tm_sec = 59;
t.tm_min = 55;
t.tm_hour = 23;
@@ -4698,7 +4698,7 @@ template <>
wstring
__time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct)
{
- tm t;
+ tm t = {0};
t.tm_sec = 59;
t.tm_min = 55;
t.tm_hour = 23;
OpenPOWER on IntegriCloud