Greetings --

Quite some time ago (2 years) I independently increased the tool table to
1000 entries. I discovered an issue where 'io' segfaulted when reading a
1000 entry tool table file in an 'io' compiled for a smaller table.
loadToolTable() in tool_parse.cc ran off the end of the toolTable[] array
passed to it. In my case 'io' had been compiled for 256 tool entries and it
segfaulted reading tool #285.

Here is a patch that fixed the segfault.

@@ -257,12 +258,16 @@ int loadToolTable(const char *filename,

             if (ttcomments && comment)
                 strcpy(ttcomments[pocket], comment);
+
+            if (!random_toolchanger && toolTable[0].toolno ==
toolTable[pocket].toolno) {
+                toolTable[0] = toolTable[pocket];
+            }
+
         } else {
             fprintf(stderr, "Unrecognized line skipped: %s", orig_line);
         }
-        if (!random_toolchanger && toolTable[0].toolno ==
toolTable[pocket].toolno) {
-            toolTable[0] = toolTable[pocket];
-        }
+
+
     }

     // close the file

I also changed the prints()s into fprintf(stderr)s to better see what
was happening loading the too large tool table. IIRC, the printf()s
weren't making it all the way to the console.

_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to