aboutsummaryrefslogtreecommitdiff
path: root/src/encoding
diff options
context:
space:
mode:
authorDaniel Martí <mvdan@mvdan.cc>2019-12-19 14:13:59 +0000
committerDaniel Martí <mvdan@mvdan.cc>2020-02-24 09:16:18 +0000
commit218f4572f5d5832c81e13d71690791aea67dacd2 (patch)
tree212a9614daf780f259e65102a955f1e4712011fc /src/encoding
parent31acdcc701cb97040832bce371fdd8985fbea131 (diff)
downloadgo-218f4572f5d5832c81e13d71690791aea67dacd2.tar.xz
text/template: make reflect.Value indirections more robust
Always shadow or modify the original parameter name. With code like: func index(item reflect.Value, ... { v := indirectInterface(item) It was possible to incorrectly use 'item' and 'v' later in the function, which could result in subtle bugs. This is precisely the kind of mistake that led to #36199. Instead, don't keep both the old and new reflect.Value variables in scope. Always shadow or modify the original variable. While at it, simplify the signature of 'length', to receive a reflect.Value directly and save a few redundant lines. Change-Id: I01416636a9d49f81246d28b91aca6413b1ba1aa5 Reviewed-on: https://go-review.googlesource.com/c/go/+/212117 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Roberto Clapis <robclap8@gmail.com> Reviewed-by: Rob Pike <r@golang.org>
Diffstat (limited to 'src/encoding')
0 files changed, 0 insertions, 0 deletions