diff options
author | Russ Cox <rsc@golang.org> | 2022-02-02 16:41:32 -0500 |
---|---|---|
committer | Dmitri Shuralyov <dmitshur@golang.org> | 2022-02-17 19:21:56 +0000 |
commit | 2b65cde5868d8245ef8a0b8eba1e361440252d3b (patch) | |
tree | 53b67e87a483f91e2b32535d3fed503df1c9d00a /src/net/dnsclient_unix.go | |
parent | 0a6cf8706fdd0fe1bd26e4d1ecbcd41650bf5e6c (diff) | |
download | go-2b65cde5868d8245ef8a0b8eba1e361440252d3b.tar.gz go-2b65cde5868d8245ef8a0b8eba1e361440252d3b.zip |
[release-branch.go1.16] regexp/syntax: reject very deeply nested regexps in Parse
The regexp code assumes it can recurse over the structure of
a regexp safely. Go's growable stacks make that reasonable
for all plausible regexps, but implausible ones can reach the
“infinite recursion?” stack limit.
This CL limits the depth of any parsed regexp to 1000.
That is, the depth of the parse tree is required to be ≤ 1000.
Regexps that require deeper parse trees will return ErrInternalError.
A future CL will change the error to ErrInvalidDepth,
but using ErrInternalError for now avoids introducing new API
in point releases when this is backported.
Fixes #51112.
Fixes #51117.
Change-Id: I97d2cd82195946eb43a4ea8561f5b95f91fb14c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/384616
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/384855
Diffstat (limited to 'src/net/dnsclient_unix.go')
0 files changed, 0 insertions, 0 deletions