codec/h264/h264dec/fuzz/helpers.c: checking if malloc bit reader mem returns NULL

This commit is contained in:
Saxon 2019-10-20 09:29:22 +10:30
parent 08264f7bf5
commit d0f99b581d
1 changed files with 3 additions and 0 deletions

View File

@ -45,6 +45,9 @@ import (
func Fuzz(data []byte) int { func Fuzz(data []byte) int {
// Create C based BitReader based on data. // Create C based BitReader based on data.
cbr := C.new_BitReader((*C.char)(unsafe.Pointer(&data[0])), C.int(len(data))) cbr := C.new_BitReader((*C.char)(unsafe.Pointer(&data[0])), C.int(len(data)))
if cbr == nil {
panic("new_BitReader returned NULL pointer")
}
// Get the level_prefix from the C code. If got is < 0, then the C code // 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. // doesn't like it and we shouldn't have that input in the corpus, so return -1.