Closed Bug 507250 Opened 15 years ago Closed 15 years ago

SortedMap should not be dynamically allocated

Categories

(Tamarin Graveyard :: Virtual Machine, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: stejohns, Unassigned)

Details

Attachments

(1 file)

Attached patch PatchSplinter Review
SortedMap allows you to allocate it via plain operator new (not gc-new), but this is unsafe: it uses List<> to store values, which assume that it lies on the stack, in a GCObject, or in a GCRoot, none of which apply here. This can cause the storage to get freed prematurely, causing amusingly hard to diagnose bugs.

Patch simply disallows dynamic allocation of SortedMap, requiring clients to use GCSortedMap instead.
Attachment #391452 - Flags: review?(rreitmai)
Comment on attachment 391452 [details] [diff] [review]
Patch

Just wondering if we should make SortedMap a GCObject and then get rid of GCSortedMap.  

Seems like it wouldn't add much overhead and would remove a potential source of bugs.
Attachment #391452 - Flags: review?(rreitmai) → review+
Perhaps, but there is apparently one stack-based use in nanojit that I'm not prepared to try correcting at this time.
pushed to redux as 2270:a40a2fb0fe71
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Resolved fixed engineering / work item that has been pushed.  Setting status to verified.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: