aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-08-22 19:22:16 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2013-08-22 19:22:16 +0000
commitc44205cf717fc8ab8ccaf3631032fa236ba61a86 (patch)
treecfc044742a435671f93e4a6224f52d314c05c777
parentbb34907ff5f60cf1600e83ea1bb4a6c26da6854e (diff)
parent7843d44a594270bcb56e98b130603c054f8a9d38 (diff)
downloadbionic-c44205cf717fc8ab8ccaf3631032fa236ba61a86.tar.gz
Merge "Work around tzcode's reliance on signed overflow."
-rw-r--r--libc/Android.mk2
-rw-r--r--tests/time_test.cpp13
2 files changed, 15 insertions, 0 deletions
diff --git a/libc/Android.mk b/libc/Android.mk
index cfc124cae..af308cb8c 100644
--- a/libc/Android.mk
+++ b/libc/Android.mk
@@ -717,6 +717,8 @@ LOCAL_CFLAGS := \
-DTZDIR=\"/system/usr/share/zoneinfo\" \
-DTM_GMTOFF=tm_gmtoff \
-DUSG_COMPAT=1
+# tzcode currently relies on signed overflow in numerous places (http://b/10310929).
+LOCAL_CFLAGS += -fno-strict-overflow
LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_MODULE := libc_tzcode
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
diff --git a/tests/time_test.cpp b/tests/time_test.cpp
index 0ad4763a1..02163a554 100644
--- a/tests/time_test.cpp
+++ b/tests/time_test.cpp
@@ -54,3 +54,16 @@ TEST(time, gmtime) {
ASSERT_EQ(0, broken_down->tm_mon);
ASSERT_EQ(1970, broken_down->tm_year + 1900);
}
+
+#ifdef __BIONIC__
+TEST(time, mktime_10310929) {
+ struct tm t;
+ memset(&t, 0, sizeof(tm));
+ t.tm_year = 200;
+ t.tm_mon = 2;
+ t.tm_mday = 10;
+
+ ASSERT_EQ(-1, mktime(&t));
+ ASSERT_EQ(-1, mktime_tz(&t, "UTC"));
+}
+#endif