Skip to content

html: Unbounded buffering during tokenization #7053

Closed
@CSEMike

Description

@CSEMike
The go.net/html tokenizer does not limit buffering. For example, the following program
will crash OOM:

    pr, pw := io.Pipe()
    z := NewTokenizer(pr)
    go z.Next()
    pw.Write([]byte("<"))
    b := []byte(strings.Repeat("t", 1024*1024))
    for {
        pw.Write(b)
    }

To improve robustness, the tokenizer should limit buffering.

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