shithub: opus

Download patch

ref: 2f37feb7cec9f856a05665b2ee7f41452767b9a1
parent: b459e4cedab04ffb4047a0adf5f3b03149c29e80
author: Marcus Asteborg <maastebo@microsoft.com>
date: Fri Nov 20 16:28:56 EST 2020

cmake - add option for fuzzing

Signed-off-by: Ralph Giles <giles@thaumas.net>

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -63,6 +63,10 @@
 option(OPUS_HARDENING ${OPUS_HARDENING_HELP_STR} ON)
 add_feature_info(OPUS_HARDENING OPUS_HARDENING ${OPUS_HARDENING_HELP_STR})
 
+set(OPUS_FUZZING_HELP_STR "causes the encoder to make random decisions (do not use in production).")
+option(OPUS_FUZZING ${OPUS_FUZZING_HELP_STR} OFF)
+add_feature_info(OPUS_FUZZING OPUS_FUZZING ${OPUS_FUZZING_HELP_STR})
+
 set(OPUS_INSTALL_PKG_CONFIG_MODULE_HELP_STR "install pkg-config module.")
 option(OPUS_INSTALL_PKG_CONFIG_MODULE ${OPUS_INSTALL_PKG_CONFIG_MODULE_HELP_STR} ON)
 add_feature_info(OPUS_INSTALL_PKG_CONFIG_MODULE OPUS_INSTALL_PKG_CONFIG_MODULE ${OPUS_INSTALL_PKG_CONFIG_MODULE_HELP_STR})
@@ -279,6 +283,10 @@
 
 if(OPUS_HARDENING)
   target_compile_definitions(opus PRIVATE ENABLE_HARDENING)
+endif()
+
+if(OPUS_FUZZING)
+  target_compile_definitions(opus PRIVATE FUZZING)
 endif()
 
 if(OPUS_VAR_ARRAYS)