From fd7e920adda8e12a54a5768dca10dbe78ac44ba6 Mon Sep 17 00:00:00 2001 From: srn Date: Thu, 14 Dec 2006 11:39:21 +0000 Subject: [PATCH] Added additional checks of inputed GUID string, now if the string is not valid GUID the exception "invalid_argument" is raised --- src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx | 3 +++ src/SALOMEDS/SALOMEDS_AttributeUserID.cxx | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx b/src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx index 59703419d..8cac2063e 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx @@ -25,6 +25,7 @@ #include "SALOMEDS.hxx" #include +#include #include #include @@ -248,6 +249,8 @@ _PTR(AttributeTreeNode) SALOMEDS_AttributeTreeNode::GetFirst() void SALOMEDS_AttributeTreeNode::SetTreeID(const std::string& value) { + if(!Standard_GUID::CheckGUIDFormat((char*)value.c_str())) throw invalid_argument("Invalid GUID"); + if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; diff --git a/src/SALOMEDS/SALOMEDS_AttributeUserID.cxx b/src/SALOMEDS/SALOMEDS_AttributeUserID.cxx index 1b73e3c5c..c20087a47 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeUserID.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeUserID.cxx @@ -25,6 +25,8 @@ #include "SALOMEDS.hxx" #include +#include + #include #include #include @@ -55,6 +57,8 @@ std::string SALOMEDS_AttributeUserID::Value() void SALOMEDS_AttributeUserID::SetValue(const std::string& value) { + if(!Standard_GUID::CheckGUIDFormat((char*)value.c_str())) throw invalid_argument("Invalid GUID"); + if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; -- 2.39.2