fix(gen): REnum 变体检测避免指针减法生成非法 sub i8*
rc_mq_dot - rc_mq_path 两操作数都是 str(i8*),TPC 直接发 sub i8*, i8* 非法 IR,opt ASan 插桩失败。改用 strlen 整数差计算模块前缀长度 (strlen(path) - strlen(cls) - 1),与既有 d_i - d_start 整数减法写法一致。
This commit is contained in:
1 parent
e700de1055
commit
fa52fbd4e5
1 file changed
+4
-2
@@ -437,8 +437,10 @@ class CallGenMixin(CallGenBase.CallGenBase):
|
||||
if rc_mq_path is not None:
|
||||
rc_mq_dot: str = string.strrchr(rc_mq_path, 46) # 46 = ord('.')
|
||||
if rc_mq_dot is not None and rc_mq_dot[1] != '\0':
|
||||
# 模块路径 = 末段之前(支持多级: w32.fileio.Class.Variant)
|
||||
rc_mq_len: t.CSizeT = rc_mq_dot - rc_mq_path
|
||||
# 模块路径 = 末段之前(支持多级: w32.fileio.Class.Variant)。
|
||||
# 注意:不能用 rc_mq_dot - rc_mq_path 指针减法(TPC 直接发
|
||||
# sub i8*, i8* 非法 IR),用 strlen 整数差扣除末段与分隔点。
|
||||
rc_mq_len: t.CSizeT = string.strlen(rc_mq_path) - string.strlen(rc_mq_dot + 1) - 1
|
||||
rc_mq_mod: str = pool.alloc(rc_mq_len + 1)
|
||||
if rc_mq_mod is not None:
|
||||
string.memcpy(rc_mq_mod, rc_mq_path, rc_mq_len)
|
||||
|
||||
Reference in new issue
Block a user