Skip to content

html parser doesn't like "-" in attributes #1890

@rogpeppe

Description

@rogpeppe
The following program causes the html parser to go into an infinite loop.

4766925f012c+ tip

package main

import (
    "fmt"
    "html"
    "strings"
)

var body = `
    <!doctype html>
    <html>
        <head>
            <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
`

func main() {
    r := strings.NewReader(body)
    _, err := html.Parse(r)
    if err != nil {
        fmt.Println("parse: ", err)
        return
    }
    fmt.Printf("parsed\n")
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions