From 260a278aefde836683ea9a7e68f3983030338f39 Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Mon, 27 Jun 2005 01:36:35 +0200 Subject: [PATCH] [PATCH] avoid segfault in check_byte_count() Avoid deferencing a null pointer in check_byte_count() after parse errors in the checked function. Signed-off-by: Luc Van Oostenryck Signed-off-by: Linus Torvalds --- check.c | 2 ++ validation/check_byte_count-ice.c | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 validation/check_byte_count-ice.c diff --git a/check.c b/check.c index 089833d6..c42664b9 100644 --- a/check.c +++ b/check.c @@ -133,6 +133,8 @@ static void check_range_instruction(struct instruction *insn) static void check_byte_count(struct instruction *insn, pseudo_t count) { + if (!count) + return; if (count->type == PSEUDO_VAL) { long long val = count->value; if (val <= 0 || val > 100000) diff --git a/validation/check_byte_count-ice.c b/validation/check_byte_count-ice.c new file mode 100644 index 00000000..eaeef960 --- /dev/null +++ b/validation/check_byte_count-ice.c @@ -0,0 +1,6 @@ +#include + +static void foo(void *a) +{ + memset(foo, + ', 20); +} -- 2.11.4.GIT