Skip to content

Commit f627c7d

Browse files
committed
Assert if timezone name is truncated
See emscripten-core#21582
1 parent 2316d8a commit f627c7d

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

src/library.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,10 @@ addToLibrary({
651651
};
652652
var winterName = extractZone(winter);
653653
var summerName = extractZone(summer);
654+
#if ASSERTIONS
655+
assert(lengthBytesUTF8(winterName) <= {{{ cDefs.TZNAME_MAX }}}, `timezone name truncated to fix in TZNAME_MAX (${winterName})`);
656+
assert(lengthBytesUTF8(summerName) <= {{{ cDefs.TZNAME_MAX }}}, `timezone name truncated to fix in TZNAME_MAX (${summerName})`);
657+
#endif
654658
if (summerOffset < winterOffset) {
655659
// Northern hemisphere
656660
stringToUTF8(winterName, std_name, {{{ cDefs.TZNAME_MAX + 1 }}});

test/runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def get_all_tests(modules):
135135

136136

137137
def get_crossplatform_tests(modules):
138-
suites = ['core2', 'other'] # We don't need all versions of every test
138+
suites = ['core0', 'other'] # We don't need all versions of every test
139139
crossplatform_tests = []
140140
# Walk over the test suites and find the test functions with the
141141
# is_crossplatform_test attribute applied by @crossplatform decorator

test/test_core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2656,6 +2656,7 @@ def test_strptime_reentrant(self):
26562656
self.set_setting('EXIT_RUNTIME')
26572657
self.do_core_test('test_strptime_reentrant.c')
26582658

2659+
@crossplatform
26592660
def test_strftime(self):
26602661
self.do_core_test('test_strftime.c')
26612662

0 commit comments

Comments
 (0)