Skip to content

Commit 932c594

Browse files
waskyosipma
authored andcommitted
escape carriage return and double quote characters
otherwise we can get invalid liftings for strings containing those characters.
1 parent 02f95a2 commit 932c594

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

CodeHawk/CHB/bchlibelf/bCHELFSection.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ object (self)
119119
if Char.code s.[offset + len] = 0 then
120120
let str = String.sub s offset len in
121121
let new_s = string_replace '\n' "\\n" str in
122+
let new_s = string_replace '\r' "\\r" new_s in
123+
let new_s = string_replace '"' "\\\"" new_s in
122124
begin
123125
string_table#add_string va new_s;
124126
Some new_s

CodeHawk/CHB/bchlibelf/bCHELFSegment.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ object (self)
8787
if Char.code s.[offset+len] = 0 then
8888
let str = String.sub s offset len in
8989
let new_s = string_replace '\n' "\\n" str in
90+
let new_s = string_replace '\r' "\\r" new_s in
91+
let new_s = string_replace '"' "\\\"" new_s in
9092
begin
9193
string_table#add_string va new_s ;
9294
Some new_s

0 commit comments

Comments
 (0)