From 7b22fa81ded0f6f59e250ffea63c5d2a0f928b25 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Wed, 5 Jan 2022 07:46:58 -0800 Subject: [PATCH] raise for non-stat data --- jc/parsers/stat_s.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/jc/parsers/stat_s.py b/jc/parsers/stat_s.py index 66b9d739..09d10a80 100644 --- a/jc/parsers/stat_s.py +++ b/jc/parsers/stat_s.py @@ -233,9 +233,17 @@ def parse(data, raw=False, quiet=False, ignore_exceptions=False): output_line['birth_time'] = line_list[1] continue + # catch non-stat data + if not line.startswith(' File: '): + raise ParseError('Not stat data') + # FreeBSD/OSX output if os_type != 'linux': value = shlex.split(line) + + if not value[1].isdigit(): + raise ParseError('Not stat data') + output_line = { 'file': ' '.join(value[15:]), 'unix_device': value[0],