From e4963f73f230cbb594c553864b2d61f6e410c236 Mon Sep 17 00:00:00 2001 From: vabr-g Date: Mon, 1 Mar 2021 21:21:11 +0100 Subject: [PATCH] Fix a null dereference in UrdfParser When the parser sees no tag inside a , it logs an error but does not return false. So in the next step, a null pointer is dereferenced. This can be tested with loading the following URDF: ``` ``` --- examples/Importers/ImportURDFDemo/UrdfParser.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/Importers/ImportURDFDemo/UrdfParser.cpp b/examples/Importers/ImportURDFDemo/UrdfParser.cpp index 3348665d5..235e6ee8c 100644 --- a/examples/Importers/ImportURDFDemo/UrdfParser.cpp +++ b/examples/Importers/ImportURDFDemo/UrdfParser.cpp @@ -1132,6 +1132,7 @@ bool UrdfParser::parseDeformable(UrdfModel& model, tinyxml2::XMLElement* config, if (!i) { logger->reportError("expected an inertial element"); + return false; } UrdfInertia inertia; if (!parseInertia(inertia, i, logger))