• Samuel Tan's avatar
    html/template: prevent aliasing of parse Trees via AddParseTree · cd0a5f08
    Samuel Tan authored
    Check all associated templates in the set for an existing reference
    to the given Tree in AddParseTree before assigning that reference
    to a new or existing template. This prevents multiple html/template
    Templates from referencing and modifying the same underlying Tree.
    
    While there, fix a few existing unit tests so that they terminate
    upon encountering unrecoverable failures.
    
    Fixes #21844
    
    Change-Id: I6b4f6996cf5467113ef94f7b91a6933dbbc21839
    Reviewed-on: https://go-review.googlesource.com/64770
    Run-TryBot: Rob Pike <r@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarRob Pike <r@golang.org>
    cd0a5f08
escape_test.go 48.4 KB