Your patch remedies the problem, but I'm concerned that there is either a bad coding practice somewhere or a bug in tog-pegasus implementation of setProperty.
The issue here is the CMPIData has a property called state that indicates whether the embedded value is valid. If the value type contained in the value property is a NULL value then that state should be set to CMPI_nullvalue, and a call to the CMIsNullValue macro should return true. This means that the secondary check of data.value.string should be redundant.
So, either there is code in nfsv3 that fails to set the state property in the CMPIData object or tog-pegasus implementation of the setProperty of getProperty methods don't set the state correctly behind the scenes.
Also, I don't see this issue at all on my stock RHEL6 development image.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Based on the following analysis this is a regression in tog-pegasus. Reviewing the CMPI 2.0 spec for a property defined by the schema but unset the data.state should be set to CMPI_nullValue thus making the secondary null check in the patch unnecessary. The following Pegasus defect has been opened in response http://bugzilla.openpegasus.org/show_bug.cgi?id=8996.
CMPIData value;
char * str;
str = "Description";
/* str = "GarbageProp"; */
data = CMGetProperty(ci, str, NULL);
_OSBASE_TRACE(2,("--- CMGetProperty on unset property %s", str));
if ((data.state) & CMPI_nullValue)
_OSBASE_TRACE(2,("--- unset property state = CMPI_nullValue"));
if ((data.state) & CMPI_goodValue)
_OSBASE_TRACE(2,("--- unset property state = CMPI_goodValue"));
if ((data.state) & CMPI_keyValue)
_OSBASE_TRACE(2,("--- unset property state = CMPI_keyValue"));
if ((data.state) & CMPI_notFound)
_OSBASE_TRACE(2,("--- unset property state = CMPI_notFound"));
if ((data.state) & CMPI_badValue)
_OSBASE_TRACE(2,("--- unset property state = CMPI_badValue"));;
1.) Performing a CMGetProperty on a unset property defined by the class schema
Looking at stack, the problem occurs when data value is accessed and is null.
Patch is attached to address this issue.
check data string value before using
Can you post the stack trace for this bug?
Your patch remedies the problem, but I'm concerned that there is either a bad coding practice somewhere or a bug in tog-pegasus implementation of setProperty.
The issue here is the CMPIData has a property called state that indicates whether the embedded value is valid. If the value type contained in the value property is a NULL value then that state should be set to CMPI_nullvalue, and a call to the CMIsNullValue macro should return true. This means that the secondary check of data.value.string should be redundant.
So, either there is code in nfsv3 that fails to set the state property in the CMPIData object or tog-pegasus implementation of the setProperty of getProperty methods don't set the state correctly behind the scenes.
Also, I don't see this issue at all on my stock RHEL6 development image.
Based on the following analysis this is a regression in tog-pegasus. Reviewing the CMPI 2.0 spec for a property defined by the schema but unset the data.state should be set to CMPI_nullValue thus making the secondary null check in the patch unnecessary. The following Pegasus defect has been opened in response http://bugzilla.openpegasus.org/show_bug.cgi?id=8996.
CMPIData value;
char * str;
str = "Description";
/* str = "GarbageProp"; */
data = CMGetProperty(ci, str, NULL);
_OSBASE_TRACE(2,("--- CMGetProperty on unset property %s", str));
if ((data.state) & CMPI_nullValue)
_OSBASE_TRACE(2,("--- unset property state = CMPI_nullValue"));
if ((data.state) & CMPI_goodValue)
_OSBASE_TRACE(2,("--- unset property state = CMPI_goodValue"));
if ((data.state) & CMPI_keyValue)
_OSBASE_TRACE(2,("--- unset property state = CMPI_keyValue"));
if ((data.state) & CMPI_notFound)
_OSBASE_TRACE(2,("--- unset property state = CMPI_notFound"));
if ((data.state) & CMPI_badValue)
_OSBASE_TRACE(2,("--- unset property state = CMPI_badValue"));;
1.) Performing a CMGetProperty on a unset property defined by the class schema
tog-pegasus-2.9
[2] [07/12/2011 19:07:06] --- cmpiOSBase_ComputerSystem.c(151) : --- CMGetProperty on unset property Description
[2] [07/12/2011 19:07:06] --- cmpiOSBase_ComputerSystem.c(154) : --- unset property state = CMPI_nullValue
tog-pegasus-2.11
[2] [07/12/2011 19:00:18] --- cmpiOSBase_ComputerSystem.c(151) : --- CMGetProperty on unset property Description
[2] [07/12/2011 19:00:18] --- cmpiOSBase_ComputerSystem.c(162) : --- unset property state = CMPI_badValue
2.) Performing a CMGetProperty on garbage property not defined by class schema (I tested this case out of curiosity)
tog-pegasus-2.9
[2] [07/12/2011 19:09:35] --- cmpiOSBase_ComputerSystem.c(151) : --- CMGetProperty on unset property GarbageProp
[2] [07/12/2011 19:09:35] --- cmpiOSBase_ComputerSystem.c(154) : --- unset property state = CMPI_nullValue
[2] [07/12/2011 19:09:35] --- cmpiOSBase_ComputerSystem.c(160) : --- unset property state = CMPI_notFound
tog-pegasus-2.11
[2] [07/12/2011 19:11:42] --- cmpiOSBase_ComputerSystem.c(151) : --- CMGetProperty on unset property GarbageProp
[2] [07/12/2011 19:11:42] --- cmpiOSBase_ComputerSystem.c(162) : --- unset property state = CMPI_badValue