Dmitry Vyukov | e1ee314 | 2015-07-17 17:53:48 -0700 | [diff] [blame^] | 1 | // Copyright 2015 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package trace |
| 6 | |
| 7 | import ( |
| 8 | "strings" |
| 9 | "testing" |
| 10 | ) |
| 11 | |
| 12 | func TestCorruptedInputs(t *testing.T) { |
| 13 | // These inputs crashed parser previously. |
| 14 | tests := []string{ |
| 15 | "gotrace\x00\x020", |
| 16 | "gotrace\x00Q00\x020", |
| 17 | "gotrace\x00T00\x020", |
| 18 | "gotrace\x00\xc3\x0200", |
| 19 | } |
| 20 | for _, data := range tests { |
| 21 | events, err := Parse(strings.NewReader(data)) |
| 22 | if err == nil || events != nil { |
| 23 | t.Fatalf("no error on input: %q\n", t) |
| 24 | } |
| 25 | } |
| 26 | } |