dotgnu-pnet
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pnet-developers] [bugs #10706] SegFault when setting member field via C


From: Thong Nguyen
Subject: [Pnet-developers] [bugs #10706] SegFault when setting member field via ClrField.SetValue()
User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; MyIE2; Maxthon; .NET CLR 1.1.4322)

This mail is an automated notification from the bugs tracker
 of the project: DotGNU Portable.NET.

/**************************************************************************/
[bugs #10706] Latest Modifications:

Changes by: 
                Thong Nguyen <address@hidden>
'Date: 
                Mon 10/18/2004 at 03:40 (NZ)

            What     | Removed                   | Added
---------------------------------------------------------------------------
         Assigned to | None                      | tum


------------------ Additional Follow-up Comments ----------------------------
Good catch.

Remember that you need to handle assigning null to valuetype fields too.

I'll fix this soon.






/**************************************************************************/
[bugs #10706] Full Item Snapshot:

URL: <http://savannah.gnu.org/bugs/?func=detailitem&item_id=10706>
Project: DotGNU Portable.NET
Submitted by: Andre Seidelt
On: Sun 10/17/2004 at 10:36

Category:  None
Severity:  5 - Average
Item Group:  None
Resolution:  None
Privacy:  Public
Assigned to:  tum
Status:  Open


Summary:  SegFault when setting member field via ClrField.SetValue()

Original Submission:  When a null-value is set via SetValue() the VM bails out
with a SegFault. This is because the check for assignment
compatibility is done for null-value, too.

Suggested fix (sorry, no time for a propper diff-patch):
replace the following code at the end of _IL_ClrField_SetValueInternal()

objectType = ILClassToType(GetObjectClass(value));

if(!ILTypeAssignCompatible(ILProgramItem_Image(field), objectType, type))
{
  ILExecThreadThrowSystem(thread, "System.ArgumentException", 0);
  return;
}

/* Fetch the value, box it, and return */
if(ILTypeIsReference(type))
{
  *((ILObject **)ptr) = value;
}
else
{
  ILExecThreadUnbox(thread, type, value, ptr);
}

WITH

if(value == NULL) {
  // if the value is NULL just set it
  *((ILObject **)ptr) = value;
} else {
  [the above code]
}



Follow-up Comments
------------------


-------------------------------------------------------
Date: Mon 10/18/2004 at 03:40       By: Thong Nguyen <tum>
Good catch.

Remember that you need to handle assigning null to valuetype fields too.

I'll fix this soon.












For detailed info, follow this link:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=10706>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]