From 6aad350baa0fb00fd13e085e035ac512fd03acc8 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Thu, 7 Oct 2010 02:33:06 +0000 Subject: [PATCH] Fix PC-in-builtin detection. n_builtins must be incremented if it is ever to exceed 0... --- src/microcode/cmpint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/microcode/cmpint.c b/src/microcode/cmpint.c index 4c5ee4c92..24b28ebe2 100644 --- a/src/microcode/cmpint.c +++ b/src/microcode/cmpint.c @@ -2812,7 +2812,7 @@ declare_builtin (unsigned long builtin, const char * name) } else { - unsigned int scan = n_builtins; + unsigned int scan = (n_builtins++); while (low < scan) { (builtins [scan]) = (builtins [scan - 1]); @@ -2837,6 +2837,7 @@ int pc_to_builtin_index (unsigned long pc) { if (! ((builtins != 0) + && (n_builtins > 0) && (pc >= (builtins[0])) && (pc < (builtins [(n_builtins - 1)])))) return (-1); -- 2.25.1