Avoid potential negative array index access to cached text.
[LibreOffice.git] / m4 / libo_fuzz_configury.m4
blob013908e28db3a0a5ed957066625762604b02a1de
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 AC_DEFUN([libo_FUZZ_ARG_WITH], [
10     AC_ARG_WITH([$1],
11         [$2],
12         [$3],
13         if test "$enable_fuzz_options" = yes; then
14             if test `expr $RANDOM % 2` = 1; then
15                 m4_translit([with-$1], [-+.], [___])=yes
16             else
17                 m4_translit([with-$1], [-+.], [___])=no
18             fi
19             AC_MSG_NOTICE([Randomly set --with-$1=$m4_translit([with-$1], [-+.], [___])])
20             libo_fuzzed_[]m4_translit([with-$1], [-+.], [___])=yes
21             libo_fuzz_list="$libo_fuzz_list --with-$1="'$m4_translit([with-$1], [-+.], [___])'
22         fi
23         [$4]
24         )
27 AC_DEFUN([libo_FUZZ_ARG_ENABLE], [
28     AC_ARG_ENABLE([$1],
29         [$2],
30         [$3],
31         if test "$enable_fuzz_options" = yes; then
32             if test `expr $RANDOM % 2` = 1; then
33                 m4_translit([enable-$1], [-+.], [___])=yes
34             else
35                 m4_translit([enable-$1], [-+.], [___])=no
36             fi
37             AC_MSG_NOTICE([Randomly set --enable-$1=$m4_translit([enable-$1], [-+.], [___])])
38             libo_fuzzed_[]m4_translit([enable-$1], [-+.], [___])=yes
39             libo_fuzz_list="$libo_fuzz_list --enable-$1="'$m4_translit([enable-$1], [-+.], [___])'
40         fi
41         [$4])
44 AC_DEFUN([libo_FUZZ_SUMMARY], [
45     if test -n "$libo_fuzz_list"; then
46         tmps=`eval echo $libo_fuzz_list`
47         AC_MSG_NOTICE([Summary of fuzzing: $tmps])
48     fi
51 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: