am 6b5eb313: am e5ac43e1: am c44205cf: Merge "Work around tzcode\'s reliance on signed overflow."

* commit '6b5eb3134adb3d08c0803228ce79d3a5b14d4fac':
  Work around tzcode's reliance on signed overflow.
This commit is contained in:
Elliott Hughes 2013-08-22 12:30:08 -07:00 committed by Android Git Automerger
commit 617368d07d
2 changed files with 15 additions and 0 deletions

View File

@ -718,6 +718,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

View File

@ -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