Skip to content

Commit

Permalink
\u0000 characters are no longer removed, instead they are replaced wi…
Browse files Browse the repository at this point in the history
…th \uFFFD.
  • Loading branch information
Knagis committed Jun 25, 2015
1 parent 472c49c commit 9bcb148
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CommonMark.Tests/GeneralTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class GeneralTests
[TestCategory("Security")]
public void TestZeroCharRemoval()
{
Helpers.ExecuteTest("\u0000*foo*\0", "<p><em>foo</em></p>");
Helpers.ExecuteTest("\u0000*foo*\0", "<p>\uFFFD<em>foo</em>\uFFFD</p>");
}

[TestMethod]
Expand Down
2 changes: 1 addition & 1 deletion CommonMark.Tests/SourcePositionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public void SourcePositionComplex()
{
"**foo**",
"foo",
"bar",
"\0bar",
"*quoting **is nice***",
"**is nice**",
"`right`",
Expand Down
12 changes: 1 addition & 11 deletions CommonMark/Parser/TabTextReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,7 @@ public void ReadLine(LineInfo line)
}
else if (c == '\0')
{
if (!useBuilder)
{
useBuilder = true;
this._builder.Length = 0;
}

if (line.IsTrackingPositions)
line.AddOffset(this._previousBufferLength + num + tabIncreaseCount, 1);

this._builder.Append(this._buffer, this._bufferPosition, num - this._bufferPosition);
this._bufferPosition = num + 1;
this._buffer[num] = '\uFFFD';
}

num++;
Expand Down

0 comments on commit 9bcb148

Please sign in to comment.