aboutsummaryrefslogtreecommitdiff
path: root/src/go/parser/parser_test.go
AgeCommit message (Collapse)Author
2022-07-12[release-branch.go1.17] go/parser: limit recursion depthRoland Shoemaker
Limit nested parsing to 100,000, which prevents stack exhaustion when parsing deeply nested statements, types, and expressions. Also limit the scope depth to 1,000 during object resolution. Thanks to Juho Nurminen of Mattermost for reporting this issue. Fixes #53707 Updates #53616 Fixes CVE-2022-1962 Change-Id: I4d7b86c1d75d0bf3c7af1fdea91582aa74272c64 Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1491025 Reviewed-by: Russ Cox <rsc@google.com> Reviewed-by: Damien Neil <dneil@google.com> (cherry picked from commit 6a856f08d58e4b6705c0c337d461c540c1235c83) Reviewed-on: https://go-review.googlesource.com/c/go/+/417070 Reviewed-by: Heschi Kreinick <heschi@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Knyszek <mknyszek@google.com>
2020-12-02go/parser: ignore subdirectories in ParseDirCarlos Alexandro Becker
Issue and PR on GoReleaser: - https://github.com/goreleaser/goreleaser/issues/1897 - https://github.com/goreleaser/goreleaser/pull/1899 Fixes #42951. Change-Id: Ia0d6018e0bad59cd60cd600188c368c431032a4b GitHub-Last-Rev: be59d85fe2d473f4dfd828a244023c4064d6e31f GitHub-Pull-Request: golang/go#42581 Reviewed-on: https://go-review.googlesource.com/c/go/+/269897 Trust: Robert Griesemer <gri@golang.org> Trust: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
2020-10-20all: update references to symbols moved from os to io/fsRuss Cox
The old os references are still valid, but update our code to reflect best practices and get used to the new locations. Code compiled with the bootstrap toolchain (cmd/asm, cmd/dist, cmd/compile, debug/elf) must remain Go 1.4-compatible and is excluded. For #41190. Change-Id: I8f9526977867c10a221e2f392f78d7dec073f1bd Reviewed-on: https://go-review.googlesource.com/c/go/+/243907 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2019-09-18go/parser: return partial result from ParseExpr in case of errorRobert Griesemer
Remove redundant code and improve documentation in the process. Fixes #34211. Change-Id: I9a6d1467f1a2c98a163f41f9df147fc6500c6fad Reviewed-on: https://go-review.googlesource.com/c/go/+/196077 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-09-15go/parser: fix ignored errors in ParseExprFromBen Shi
This CL fixes a bug in ParseExprFrom which makes error messages ignored when there are 10+ errors in a single expression. fixes #34241 fixes #34274 Change-Id: I29a82d3e3e726279005eb6fbcd7ee3aebffaa679 Reviewed-on: https://go-review.googlesource.com/c/go/+/194638 Run-TryBot: Ben Shi <powerman1st@163.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
2017-06-12go/parser: handle last line commentsHiroshi Ioka
Fixes #20636 Change-Id: Icea0012fecb73944c95f6037922505c63b57b245 Reviewed-on: https://go-review.googlesource.com/45295 Reviewed-by: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-05-20go/parser: parse incomplete selection "fmt." as a blank selection "fmt._"Alan Donovan
Formerly it would return a BadExpr. This prevents partial syntax from being discarded, and makes the error recovery logic more consistent with other places where an identifier was expected but not found. + test Change-Id: I223c0c0589e7ceb7207ae951b8f71b9275a1eb73 Reviewed-on: https://go-review.googlesource.com/10269 Reviewed-by: Robert Griesemer <gri@golang.org>
2015-02-24go/ast, go/parser: correct End() position for *ast.EmptyStmtRobert Griesemer
- added a new field ast.EmptyStmt.Implicit to indicate explicit or implicit semicolon - fix ast.EmptyStmt.End() accordingly - adjusted parser and added test case Fixes #9979. Change-Id: I72b0983b3a0cabea085598e1bf6c8df629776b57 Reviewed-on: https://go-review.googlesource.com/5720 Reviewed-by: Russ Cox <rsc@golang.org>
2014-11-20go/parser: Use test-specific filesets to avoid races.Robert Griesemer
Only affects test code. Fixes #9025. Fixes #9130. LGTM=r, adonovan R=adonovan, r CC=golang-codereviews https://golang.org/cl/180920043
2014-09-08build: move package sources from src/pkg to srcRuss Cox
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.