From 4eefd77886311f75601b5f4078580e2bfcb621b0 Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Thu, 6 Feb 2020 10:27:31 -0800 Subject: [PATCH] internal/impl: init map value MessageInfos in validator I'm not sure how to write a good test for this one, since it's so specific to both the code and the ordering of initialization. Just sticking the fuzzer-provided case into our standard test message set doesn't do it, because something else has initialized the MessageInfo by the time the test gets there. Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20543 Change-Id: I508222b43e52287f73e2ed32ce9b954a5f81717b Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/218257 Reviewed-by: Joe Tsai --- internal/impl/validate.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/impl/validate.go b/internal/impl/validate.go index e2100861..e568c758 100644 --- a/internal/impl/validate.go +++ b/internal/impl/validate.go @@ -434,6 +434,9 @@ State: vi.mi.init() fallthrough case validationTypeMap: + if vi.mi != nil { + vi.mi.init() + } states = append(states, validationState{ typ: vi.typ, keyType: vi.keyType,