Skip to content

Commit 0fa7a3e

Browse files
committed
escape carriage return and double quote characters
otherwise we can get invalid liftings for strings containing those characters.
1 parent 02f95a2 commit 0fa7a3e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

CodeHawk/CHB/bchlibelf/bCHELFSection.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ object (self)
118118
end in
119119
if Char.code s.[offset + len] = 0 then
120120
let str = String.sub s offset len in
121-
let new_s = string_replace '\n' "\\n" str in
121+
let new_s = string_replace '"' "\\\"" (string_replace '\r' "\\r" (string_replace '\n' "\\n" str)) in
122122
begin
123123
string_table#add_string va new_s;
124124
Some new_s

CodeHawk/CHB/bchlibelf/bCHELFSegment.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ object (self)
8686
end in
8787
if Char.code s.[offset+len] = 0 then
8888
let str = String.sub s offset len in
89-
let new_s = string_replace '\n' "\\n" str in
89+
let new_s = string_replace '"' "\\\"" (string_replace '\r' "\\r" (string_replace '\n' "\\n" str)) in
9090
begin
9191
string_table#add_string va new_s ;
9292
Some new_s

0 commit comments

Comments
 (0)