Fix PC-in-builtin detection.
authorTaylor R Campbell <campbell@mumble.net>
Thu, 7 Oct 2010 02:33:06 +0000 (02:33 +0000)
committerTaylor R Campbell <campbell@mumble.net>
Thu, 7 Oct 2010 02:33:06 +0000 (02:33 +0000)
n_builtins must be incremented if it is ever to exceed 0...

src/microcode/cmpint.c

index 4c5ee4c92b91c7bc51235fbd4275bb780af10638..24b28ebe2f059dbc3ba20dba54e9c6ab3eff9196 100644 (file)
@@ -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);