Commit b7cccf0a
b7cccf0afd50Merged
Daniel Hoberecht <[email protected]> · 7 months ago · 1 file · ~1 modified
Description
fix(codegen): guard string += with value-type check
sp_str_concat was emitted for any lv += rval where lv is string,
even if rval is int/float. Passing a non-string pointer to
sp_str_concat is UB and could produce \x01 bytes in unrelated
output. Only emit sp_str_concat when both sides infer as string.
Details
- Commit
- b7cccf0afd50
- Parent
- 7529b0350b95
spinel_codegen.rbmodifiedView file
@@ -16296,7 +16296,7 @@
1629616296
return1629716297
end1629816298
if op == "+"16299-
if vt == "string"16299+
if vt == "string" && infer_type(@nd_expression[nid]) == "string"1630016300
@needs_string_helpers = 11630116301
emit(" " + vref + " = sp_str_concat(" + vref + ", " + val + ");")1630216302
else