mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
27 lines
580 B
Go
27 lines
580 B
Go
|
|
// Copyright 2015 The Go Authors. All rights reserved.
|
||
|
|
// Use of this source code is governed by a BSD-style
|
||
|
|
// license that can be found in the LICENSE file.
|
||
|
|
|
||
|
|
package trace
|
||
|
|
|
||
|
|
import (
|
||
|
|
"strings"
|
||
|
|
"testing"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestCorruptedInputs(t *testing.T) {
|
||
|
|
// These inputs crashed parser previously.
|
||
|
|
tests := []string{
|
||
|
|
"gotrace\x00\x020",
|
||
|
|
"gotrace\x00Q00\x020",
|
||
|
|
"gotrace\x00T00\x020",
|
||
|
|
"gotrace\x00\xc3\x0200",
|
||
|
|
}
|
||
|
|
for _, data := range tests {
|
||
|
|
events, err := Parse(strings.NewReader(data))
|
||
|
|
if err == nil || events != nil {
|
||
|
|
t.Fatalf("no error on input: %q\n", t)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|