1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-03 01:18:10 +03:00

lib/fuzzing/decode_ndr_X_crash: guess the pipe from filename

Usually we are dealing with a filename that tells you what the pipe is,
and there is no reason for this debug helper not to be convenient

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15625

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 8b6a584170)
This commit is contained in:
Douglas Bagnall 2024-03-28 12:57:54 +13:00 committed by Jule Anger
parent c206d3d20c
commit 3a840553cf

View File

@ -61,8 +61,9 @@ def process_one_file(f):
def main(): def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('-p', '--pipe', default='$PIPE', parser.add_argument('-p', '--pipe', default=None,
help='pipe name (for output command line)') help=('pipe name (for output command line, '
'default is a guess or "$PIPE")'))
parser.add_argument('-t', '--type', default=None, choices=TYPES, parser.add_argument('-t', '--type', default=None, choices=TYPES,
help='restrict to this type') help='restrict to this type')
parser.add_argument('-o', '--opnum', default=None, type=int, parser.add_argument('-o', '--opnum', default=None, type=int,
@ -91,6 +92,13 @@ def main():
sys.exit(1) sys.exit(1)
for fn in args.FILES: for fn in args.FILES:
if pipe is None:
m = re.search(r'clusterfuzz-testcase.+-fuzz_ndr_([a-z]+)', fn)
if m is None:
pipe = '$PIPE'
else:
pipe = m.group(1)
if args.crash_filter is not None: if args.crash_filter is not None:
if not re.search(args.crash_filter, fn): if not re.search(args.crash_filter, fn):
print_if_verbose(f"skipping {fn}") print_if_verbose(f"skipping {fn}")