Add check for BLIF with no model name
authorArchie <ac11018@ic.ac.uk>
Tue, 14 Jun 2022 13:17:00 +0000 (14:17 +0100)
committerLofty <dan.ravensloft@gmail.com>
Tue, 21 Jun 2022 23:34:49 +0000 (00:34 +0100)
frontends/blif/blifparse.cc

index 19844bda6e2e8920ba87aceeb88bd514e6504d6b..73d1f0ea798f206fed9aeaa95e3a6fd25e3e31b1 100644 (file)
@@ -166,7 +166,10 @@ void parse_blif(RTLIL::Design *design, std::istream &f, IdString dff_name, bool
                                        goto error;
                                module = new RTLIL::Module;
                                lastcell = nullptr;
-                               module->name = RTLIL::escape_id(strtok(NULL, " \t\r\n"));
+                               char *name = strtok(NULL, " \t\r\n");
+                               if (name == nullptr)
+                                       goto error;
+                               module->name = RTLIL::escape_id(name);
                                obj_attributes = &module->attributes;
                                obj_parameters = nullptr;
                                if (design->module(module->name))