bugDotGNU Portable.NET - Bugs: bug #7404, StringBuilder related segfault.

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #7404: StringBuilder related segfault.

Submitter:  Richard Baumann <Rich333>
Submitted:  Sat 24 Jan 2004 05:36:15 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Sat 24 Jan 2004 10:19:09 AM UTC, comment #1: 

Fix committed to CVS (pnetlib).  There were times when the
engine rounded "capacity" up to a value greater than
"maxCapacity".  This confused the "Append(char)" inline
method in CVM, which thought it could add more characters than it should have.  The StringBuilder will now clamp "capacity"
so that it won't exceed "maxCapacity".

Rhys Weatherley <rweather>
Group administrator
Sat 24 Jan 2004 05:36:15 AM UTC, original submission:  

I can't seem to get a simple test case to exhibit this behavior, so I've attached a patch which reverts my xml code to an earlier version which exhibits this behavior, and a simple xml test case which should segfault because of it. Although I'm not exactly sure where in the engine the problem is occurring, I do know what's going wrong.

The "garbage" StringBuilder, with a capacity and maxCapacity of 1, in the XmlParserInputBase class, is somehow winding up with a buildString of length 2. The AppendSpace code in StringBuilder assumes the length would never be greater than the maxCapacity, so it ends up returning -1 to Append. I traced the managed code sets of the String's length variable (by renaming length to length__ and adding a length property with traces) and by the time it's first set, the length is already at 2. Because of this, I think it's probably somewhere in pnet/engine/lib_string.c but the NewBuilder icall looks ok. That's as far as I was able to get before giving up.

Richard Baumann <Rich333>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #1016:  ilrun-segfault.tar.gz added by Rich333 (4KiB - application/gzip - xml patch and test case, which, when combined, should reproduce the problem)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

 

Follow 3 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2004-01-24 rweather StatusNone Fixed
    Open/ClosedOpen Closed
2004-01-24 Rich333 Attached File- Added ilrun-segfault.tar.gz, #996

Back to the top

Powered by Savane 3.13-caa5.
Corresponding source code