From bc90544cef731e94dece181e28b78d73493f86be Mon Sep 17 00:00:00 2001 From: yuin Date: Sat, 16 Oct 2021 18:56:49 +0900 Subject: [PATCH] #248 - 3 --- _test/extra.txt | 14 ++++++++++++++ renderer/html/html.go | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/_test/extra.txt b/_test/extra.txt index 1ffadda..9b90cf2 100644 --- a/_test/extra.txt +++ b/_test/extra.txt @@ -496,3 +496,17 @@ _a[b_c_](d) //- - - - - - - - -//
\t x\n
//= = = = = = = = = = = = = = = = = = = = = = = =// + +38: Decimal HTML entity literals should allow 7 digits +//- - - - - - - - -// +� +//- - - - - - - - -// +

\uFFFD

+//= = = = = = = = = = = = = = = = = = = = = = = =// + +39: Decimal HTML entities should not be interpreted as octal when starting with a 0 +//- - - - - - - - -// +d +//- - - - - - - - -// +

d

+//= = = = = = = = = = = = = = = = = = = = = = = =// diff --git a/renderer/html/html.go b/renderer/html/html.go index 5699150..c1b0d21 100644 --- a/renderer/html/html.go +++ b/renderer/html/html.go @@ -745,8 +745,8 @@ func (d *defaultWriter) Write(writer util.BufWriter, source []byte) { } else if nc >= '0' && nc <= '9' { start := nnext i, ok = util.ReadWhile(source, [2]int{start, limit}, util.IsNumeric) - if ok && i < limit && i-start < 8 && source[i] == ';' && i-start < 7 { - v, _ := strconv.ParseUint(util.BytesToReadOnlyString(source[start:i]), 0, 32) + if ok && i < limit && i-start < 8 && source[i] == ';' { + v, _ := strconv.ParseUint(util.BytesToReadOnlyString(source[start:i]), 10, 32) d.RawWrite(writer, source[n:pos]) n = i + 1 escapeRune(writer, rune(v))