diff options
author | Luke Shumaker <lukeshu@datawire.io> | 2022-08-16 22:40:19 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@datawire.io> | 2022-08-17 00:12:35 -0600 |
commit | e57bee02e02b7e3697d6c3cb8b75923a92100427 (patch) | |
tree | f32610f2b73fbea1f2a94e108fabca18d31d5d27 /decode.go | |
parent | 87b02577e50b76d373e3c6b921d776e39cb83346 (diff) |
Add tests for decode reading too far
Diffstat (limited to 'decode.go')
-rw-r--r-- | decode.go | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -114,7 +114,10 @@ func (dec *Decoder) stackName() string { return strings.Join(fields, ".") } -func Decode(r io.Reader, ptr any) error { +func Decode(r interface { + io.Reader + io.RuneScanner // enforce that the reader have .UnreadRune() so that we don't risk reading too far when decoding a number +}, ptr any) error { return NewDecoder(r).Decode(ptr) } |