diff options
author | Tristan Matthews <tmatth@videolan.org> | 2017-03-06 17:18:20 +0300 |
---|---|---|
committer | Tristan Matthews <tmatth@videolan.org> | 2018-10-22 06:07:10 +0300 |
commit | c2d76af0393f74e81e160382821ff825ed50799d (patch) | |
tree | df2abe403f285f78949031b2fd2f510e381cdd58 | |
parent | 00c8f61368145901ca30831ea5573c77527ef0de (diff) |
speex_decode_fuzzer: fuzz int16_t decoder as well
-rw-r--r-- | src/speex_decode_fuzzer.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/speex_decode_fuzzer.c b/src/speex_decode_fuzzer.c index 8f06637..746fd42 100644 --- a/src/speex_decode_fuzzer.c +++ b/src/speex_decode_fuzzer.c @@ -39,10 +39,17 @@ /*The frame size in hardcoded for this sample code but it doesn't have to be.*/ #define FRAME_SIZE 160 +#ifndef DISABLE_FLOAT_API + typedef float output_type; + #define speex_decode_func(a, b, c) speex_decode(a, b, c) +#else + typedef spx_int16_t output_type; + #define speex_decode_func(a, b, c) speex_decode_int(a, b, c) +#endif + int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { - /*Speex handle samples as float, so we need an array of floats.*/ - float output[FRAME_SIZE]; + output_type output[FRAME_SIZE]; void *decoder_state; SpeexBits bitstream; int tmp; @@ -61,12 +68,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) speex_bits_read_from(&bitstream, (char *)data, size); /*Decode the data, 1 packet at a time.*/ - while (!speex_decode(decoder_state, &bitstream, output)); - /*noop*/ + while (!speex_decode_func(decoder_state, &bitstream, output)) + ; /*noop*/ - /*Destroy the decoder state*/ speex_decoder_destroy(decoder_state); - /*Destroy the bit-stream struct*/ speex_bits_destroy(&bitstream); return 0; } |