已关闭
[Bug]: std.time 和 std.unicode 部分边界行为不符合预期 #603
Cangjie-ChenQian创建于 4月25日关闭于 4月27日
4月25日 添加了label:bug
4月25日 关联了pull request:fix: validate timezone data and unicode special casing
4月25日 关联了pull request:test: add std time and unicode regression cases
4月25日 添加了label:1.2.0-alpha.11
CCangjie-ChenQian
4月27日 关联了pull request:fix(std.time): reject invalid zones and malformed transitions
4月27日 关联了pull request:fix(std.time): reject invalid zones and malformed transitions
CCangjie-ChenQian
4月27日 关联了pull request:fix(std.time): reject invalid zones and malformed transitions
4月27日 关联了pull request:fix(std.time): reject invalid zones and malformed transitions
4月27日 关联了pull request:test(std.time): add timezone regression cases
4月27日 关联了pull request:test(std.time): add timezone regression cases
4月27日 添加了label:1.1.31.2.0-alpha.16
4月27日 修改了issue 的描述
4月27日 修改了issue 的描述
4月27日 关闭了 issue
发生了什么问题? | Describe the issue that occurred.
std.time与std.unicode存在以下边界行为问题:std.time的时区 ID 校验过宽,Asia\Shanghai这类包含反斜杠的非法 ID 未在参数校验阶段被拒绝,而是继续进入时区数据查找流程。std.time解析 TZif 数据时未校验 transition 时间严格递增,构造乱序 transition 的数据可以被接受,后续转换结果可能不可靠。std.unicode的Rune级大小写 API 对特殊 Unicode 映射返回原字符,与String级 API 行为不一致,例如ß、ʼn等字符。std.unicode中U+0130在土耳其语、阿塞拜疆语小写转换场景下未按 locale 规则映射为i。期望行为是什么? | What is the expected behavior?
IllegalArgumentException,避免继续进入文件查找或数据加载路径。InvalidDataException。Rune级大小写转换应与String级 API 的特殊 Unicode 映射保持一致。U+0130在土耳其语、阿塞拜疆语小写转换时应返回i。如何复现该缺陷? | How to reproduce the bug?
可通过以下场景复现:
TimeZone.load("Asia\\Shanghai"),当前行为未在参数校验阶段拒绝该非法 ID。TimeZone.loadFromTZData(...),当前行为未拒绝该数据。Rune(0x00DF).toUpperCase()或Rune(0x0149).toUpperCase(),当前行为与对应String.toUpper()结果不一致。Rune(0x0130).toLowerCase(TR)或Rune(0x0130).toLowerCase(AZ),当前行为未返回 locale 期望的小写i。其他补充信息 | Additional information
本地已补充回归用例覆盖上述场景:
testsuites/LLT/API/std/time/datetime/test_parse_format_check_input.cjtestsuites/LLT/API/std/time/timezone/test_time_report_repros.cjtestsuites/LLT/API/std/unicode/test_unicode_report_repros.cj本地验证结果:
std/time/datetime/test_parse_format_check_input.cj通过,18 个用例通过。std/time/timezone/test_time_report_repros.cj通过,2 个目标回归用例通过。std/unicode/test_unicode_report_repros.cj通过,3 个用例通过。cjc版本信息 | cjc version information
分支版本信息 | Branch version information