Skip to content
Snippets Groups Projects
Commit d29f2b50 authored by David Cole's avatar David Cole
Browse files

DICOMParser: Fix crashes in DICOMAppHelper methods

Extend the pattern already seen in the PatientNameCallback and
StudyIDCallback methods to the StudyUIDCallback and GantryAngleCallback
methods of DICOMAppHelper. Avoid calling string char* constructor and
ReturnAsFloat method when val == nullptr. Use an empty string or a
float value of 0 instead.
parent 64efc790
Branches
No related tags found
No related merge requests found
......@@ -1341,8 +1341,14 @@ void DICOMAppHelper::StudyUIDCallback(DICOMParser *,
{
delete this->StudyUID;
this->StudyUID = new dicom_stl::string(reinterpret_cast<char*>(val));
if (val)
{
this->StudyUID = new dicom_stl::string(reinterpret_cast<char*>(val));
}
else
{
this->StudyUID = new dicom_stl::string();
}
}
void DICOMAppHelper::StudyIDCallback(DICOMParser *,
......@@ -1372,8 +1378,13 @@ void DICOMAppHelper::GantryAngleCallback(DICOMParser * parser,
unsigned char* val,
quadbyte)
{
float fval = DICOMFile::ReturnAsFloat(val,
parser->GetDICOMFile()->GetPlatformIsBigEndian ());
float fval = 0;
if (val)
{
fval = DICOMFile::ReturnAsFloat(val,
parser->GetDICOMFile()->GetPlatformIsBigEndian());
}
this->GantryAngle = fval;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment