aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/xml/read_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/encoding/xml/read_test.go')
-rw-r--r--src/encoding/xml/read_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/encoding/xml/read_test.go b/src/encoding/xml/read_test.go
index 4ccab3d010..8c940aefb8 100644
--- a/src/encoding/xml/read_test.go
+++ b/src/encoding/xml/read_test.go
@@ -6,6 +6,7 @@ package xml
import (
"bytes"
+ "errors"
"io"
"reflect"
"runtime"
@@ -1097,3 +1098,16 @@ func TestCVE202230633(t *testing.T) {
}
Unmarshal(bytes.Repeat([]byte("<a>"), 17_000_000), &example)
}
+
+func TestCVE202228131(t *testing.T) {
+ type nested struct {
+ Parent *nested `xml:",any"`
+ }
+ var n nested
+ err := Unmarshal(bytes.Repeat([]byte("<a>"), maxUnmarshalDepth+1), &n)
+ if err == nil {
+ t.Fatal("Unmarshal did not fail")
+ } else if !errors.Is(err, errExeceededMaxUnmarshalDepth) {
+ t.Fatalf("Unmarshal unexpected error: got %q, want %q", err, errExeceededMaxUnmarshalDepth)
+ }
+}