]> Cypherpunks.ru repositories - gostls13.git/commit
go/types: fix panic in allowVersion when pos is invalid
authorRobert Findley <rfindley@google.com>
Mon, 7 Aug 2023 19:46:34 +0000 (15:46 -0400)
committerRobert Findley <rfindley@google.com>
Mon, 7 Aug 2023 21:16:51 +0000 (21:16 +0000)
commit008ab9adb8382a274ba25c005a046b912af94809
treec72c9a95117ed4d8f679d2b10b6ab06d287f6572
parentaca6577196d61073a74c2ba791aa89c166db9521
go/types: fix panic in allowVersion when pos is invalid

CL 515656 updated go/types to use file base as key in the posVers map,
but introduced a panic when the corresponding *token.File is nil.

Check that pos is valid before performing the lookup.

Fixes #61822

Change-Id: I1ac9d48c831a470de8439a50022ba5f59b3e0bed
Reviewed-on: https://go-review.googlesource.com/c/go/+/516738
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Robert Findley <rfindley@google.com>
src/go/types/version.go
src/internal/types/testdata/fixedbugs/issue61822.go [new file with mode: 0644]