diff options
author | qadeer <qadeer@microsoft.com> | 2012-03-11 13:06:55 -0700 |
---|---|---|
committer | qadeer <qadeer@microsoft.com> | 2012-03-11 13:06:55 -0700 |
commit | 7949e676b1c3c8b25cc88a884dfeb25d58629227 (patch) | |
tree | 090b64da25ec836e8d71bc76aa6bbfc7cf59e7f4 /BCT | |
parent | 02a38fe3bf1fad952dddcf46117be3931cf932f1 (diff) |
further sanitization of string in :value attribute
Diffstat (limited to 'BCT')
-rw-r--r-- | BCT/BytecodeTranslator/Heap.cs | 3 | ||||
-rw-r--r-- | BCT/BytecodeTranslator/Sink.cs | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/BCT/BytecodeTranslator/Heap.cs b/BCT/BytecodeTranslator/Heap.cs index aaed79e4..731d5e66 100644 --- a/BCT/BytecodeTranslator/Heap.cs +++ b/BCT/BytecodeTranslator/Heap.cs @@ -314,8 +314,7 @@ namespace BytecodeTranslator { #endregion
#region Parse the declarations
- var ms = new MemoryStream(ASCIIEncoding.UTF8.GetBytes(preludeText.ToString()));
- int errorCount = Bpl.Parser.Parse(ms, "foo", new List<string>(), out prelude);
+ int errorCount = Bpl.Parser.Parse(preludeText.ToString(), "foo", out prelude);
if (prelude == null || errorCount > 0) {
prelude = null;
return false;
diff --git a/BCT/BytecodeTranslator/Sink.cs b/BCT/BytecodeTranslator/Sink.cs index 7a1abc07..d89f1bfd 100644 --- a/BCT/BytecodeTranslator/Sink.cs +++ b/BCT/BytecodeTranslator/Sink.cs @@ -331,6 +331,8 @@ namespace BytecodeTranslator { var tident = new Bpl.TypedIdent(tok, name, t);
c = new Bpl.Constant(tok, tident, true);
str = str.Replace("\n", "\\n");
+ str = str.Replace("\r", "\\r");
+ str = str.Replace("\"", "\u0022");
var attrib = new Bpl.QKeyValue(Bpl.Token.NoToken, "value", new List<object> { str, }, null);
c.Attributes = attrib;
this.declaredStringConstants.Add(str, c);
|