1
0
Fork 0
frr/tests/lib/fuzz_zlog_inputs.py
Daniel Baumann 3124f89aed
Adding upstream version 10.1.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
2025-02-05 10:03:58 +01:00

28 lines
705 B
Python

# SPDX-License-Identifier: GPL-2.0-or-later
# zlog fuzz-tester input generator
#
# Copyright (C) 2021 David Lamparter for NetDEF, Inc.
from itertools import chain
import struct
lengths = set([128])
# lengths = [[i, i + 1, i + 3, i - 1, i - 3] for i in lengths]
# lengths = set([i for i in chain(*lengths) if i >= 0])
dsts = [0, 1, 2, 3]
fmts = [0, 1, 2, 3]
def combo():
for l0 in lengths:
for l1 in lengths:
for l2 in lengths:
for fmt in fmts:
for dst in dsts:
yield (l0, l1, l2, fmt, dst)
for i, tup in enumerate(combo()):
with open("input/i%d" % i, "wb") as fd:
fd.write(struct.pack("HHHBB", *tup))