From 453825b9435ec5740fcada42cebe246325a07c37 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Mon, 7 Aug 2023 00:54:33 +0200 Subject: Clean the code for ROST namespaces. --- src/analysis/scan/space.c | 33 --------------------------------- tests/analysis/scan/fuzzing.py | 19 +++++++++++++++++-- 2 files changed, 17 insertions(+), 35 deletions(-) diff --git a/src/analysis/scan/space.c b/src/analysis/scan/space.c index dc9a237..1e158cf 100644 --- a/src/analysis/scan/space.c +++ b/src/analysis/scan/space.c @@ -58,9 +58,6 @@ static char *g_scan_namespace_get_name(const GScanNamespace *); /* Lance une résolution d'élément à solliciter. */ static bool g_scan_namespace_resolve(GScanNamespace *, const char *, GScanContext *, GScanScope *, GRegisteredItem **); -/* Réduit une expression à une forme plus simple. */ -static GScanExpression *g_scan_namespace_reduce(GScanNamespace *, GScanContext *, GScanExpression **, size_t, bool); - /* ---------------------------------------------------------------------------------- */ @@ -98,7 +95,6 @@ static void g_scan_namespace_class_init(GScanNamespaceClass *klass) registered->get_name = (get_registered_item_name_fc)g_scan_namespace_get_name; registered->resolve = (resolve_registered_item_fc)g_scan_namespace_resolve; - registered->reduce = (reduce_registered_item_fc)g_scan_namespace_reduce; } @@ -355,32 +351,3 @@ static bool g_scan_namespace_resolve(GScanNamespace *item, const char *target, G return result; } - - -/****************************************************************************** -* * -* Paramètres : space = élément d'appel à consulter. * -* ctx = contexte de suivi de l'analyse courante. * -* args = liste d'éventuels arguments fournis. * -* count = taille de cette liste. * -* final = indique une ultime conversion dans le cycle en cours.* -* * -* Description : Réduit une expression à une forme plus simple. * -* * -* Retour : Réduction correspondante, expression déjà réduite, ou NULL. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static GScanExpression *g_scan_namespace_reduce(GScanNamespace *space, GScanContext *ctx, GScanExpression **args, size_t count, bool final) -{ - GScanExpression *result; /* Instance à renvoyer */ - - assert(false); /* REMME */ - - result = NULL; - - return result; - -} diff --git a/tests/analysis/scan/fuzzing.py b/tests/analysis/scan/fuzzing.py index 2140972..6eecac9 100644 --- a/tests/analysis/scan/fuzzing.py +++ b/tests/analysis/scan/fuzzing.py @@ -1,5 +1,5 @@ -from chrysacase import ChrysalideTestCase +from common import RostTestClass from pychrysalide.analysis.contents import MemoryContent from pychrysalide.analysis.scan import ContentScanner from pychrysalide.analysis.scan import ScanOptions @@ -7,7 +7,7 @@ from pychrysalide.analysis.scan.patterns.backends import AcismBackend from pychrysalide.analysis.scan.patterns.backends import BitapBackend -class TestRostFuzzingFixes(ChrysalideTestCase): +class TestRostFuzzingFixes(RostTestClass): """TestCases to remember all the fixes for crashes identified by fuzzing.""" def testEmptyPatternListWithContent(self): @@ -63,3 +63,18 @@ rule test { with self.assertRaisesRegex(ValueError, 'Unable to create content scanner'): scanner = ContentScanner(rule) + + + def testNamespacesWithoutReductionCode(self): + """Clean the code for ROST namespaces.""" + + rule = ''' +rule test { + + condition: + console + +} +''' + + self.check_rule_failure(rule) -- cgit v0.11.2-87-g4458