]> Cypherpunks repositories - gostls13.git/commit
encoding/json: don't indirect pointers when decoding null
authorRomain Baugue <romain.baugue@gmail.com>
Wed, 1 May 2019 12:52:57 +0000 (14:52 +0200)
committerDaniel Martí <mvdan@mvdan.cc>
Tue, 10 Sep 2019 08:24:29 +0000 (08:24 +0000)
commitb6ec56bc26a89e9733390dd41fade5baace5a641
treeb7d4d8684614fa23d6e55f6fad5b1ff2208b3c44
parentcdd2c265cc132a15e20298fbb083a70d7f3b495d
encoding/json: don't indirect pointers when decoding null

The indirect method checked the type of the child when indirecting a
pointer. If the current value is a pointer and we are decoding null, we
can skip this entirely and return early, avoiding the whole descent.

Fixes #31776

Change-Id: Ib8b2a2357572c41f56fceac59b5a858980f3f65e
Reviewed-on: https://go-review.googlesource.com/c/go/+/174699
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
src/encoding/json/decode.go
src/encoding/json/decode_test.go