From dc934380de353d16ff62c633ff949fb85b30fd13 Mon Sep 17 00:00:00 2001 From: bptato Date: Sat, 15 Jul 2023 20:12:11 +0200 Subject: htmlparser: check required callbacks --- src/html/htmlparser.nim | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/html/htmlparser.nim') diff --git a/src/html/htmlparser.nim b/src/html/htmlparser.nim index e72f897e..442068ad 100644 --- a/src/html/htmlparser.nim +++ b/src/html/htmlparser.nim @@ -2671,10 +2671,23 @@ proc bomSniff(inputStream: Stream): Charset = else: inputStream.setPosition(0) +# Any of these pointers being nil would later result in a crash. +proc checkCallbacks(dombuilder: DOMBuilder) = + doAssert dombuilder.getTemplateContent != nil + doAssert dombuilder.getParentNode != nil + doAssert dombuilder.getLocalName != nil + doAssert dombuilder.createElement != nil + doAssert dombuilder.createComment != nil + doAssert dombuilder.createDocumentType != nil + doAssert dombuilder.insertBefore != nil + doAssert dombuilder.insertText != nil + doAssert dombuilder.remove != nil + proc parseHTML*[Handle](inputStream: Stream, dombuilder: DOMBuilder[Handle], opts: HTML5ParserOpts[Handle]) = ## Parse an HTML document, using the DOMBuilder object `dombuilder`, and ## parser options `opts`. + dombuilder.checkCallbacks() var charsetStack: seq[Charset] for i in countdown(opts.charsets.high, 0): charsetStack.add(opts.charsets[i]) -- cgit 1.4.1-2-gfad0 fs log blame commit diff stats
path: root/html/401test.mu.html
blob: d236a7f2cbef91352e9c7b6279c8b28adf551ea3 (plain) (tree)
1
2
3
4
5