codec/h264/h264dec/fuzz/fuzzParseLevelPrefix/fuzz.go: swapped got and want to correct orientation

This commit is contained in:
Saxon 2019-10-20 09:17:03 +10:30
parent faf5e2df0f
commit 08264f7bf5
1 changed files with 4 additions and 4 deletions

View File

@ -48,21 +48,21 @@ func Fuzz(data []byte) int {
// Get the level_prefix from the C code. If got is < 0, then the C code
// doesn't like it and we shouldn't have that input in the corpus, so return -1.
got := C.read_levelprefix(cbr)
if got < 0 {
want := C.read_levelprefix(cbr)
if want < 0 {
return -1
}
// Get the level_prefix from the go code. If the C code was okay with this
// input, but the go code isn't then that's bad, so panic - want crasher info.
want, err := h264dec.FuzzParseLevelPrefix(bits.NewBitReader(bytes.NewReader(data)))
got, err := h264dec.FuzzParseLevelPrefix(bits.NewBitReader(bytes.NewReader(data)))
if err != nil {
panic(fmt.Sprintf("error from go parseLevelPrefix: %v", err))
}
// Compare the result of the C and go code. If they are not the same then
// panic - our go code is not doing what it should.
if int(want) != int(got) {
if int(got) != int(want) {
panic(fmt.Sprintf("did not get expected results for input: %v\nGot: %v\nWant: %v\n", data, got, want))
}
return 1