Closed Bug 555894 Opened 14 years ago Closed 14 years ago

Don't use static strings when setting environment variables

Categories

(Toolkit Graveyard :: XULRunner, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.9.3a5

People

(Reporter: glandium, Assigned: glandium)

References

Details

Attachments

(1 file)

Attached patch PatchSplinter Review
(Not exactly a xulrunner issue, but one of the XRE)

On most unix systems, I think, "putting" an environment variable (as in putenv) just adds a reference to the string that was passed as an argument. When using heap allocated strings, it obviously can fail after free()ing, but in XRE case, it uses static strings. One could think this is okay, except these strings are in libxul.so, and libxul.so is dlclose()d when terminating.

On xulrunner builds of firefox, I was getting systematic segmentation faults when running firefox with an already opened window: the second instance would load libxul.so, send its xremote command, dlclose libxul.so then crash because the environment strings were now pointing to unmapped memory.
Attachment #435827 - Attachment is patch: true
Attachment #435827 - Attachment mime type: application/octet-stream → text/plain
Attachment #435827 - Flags: review?(vladimir)
Attachment #435827 - Flags: superreview?(benjamin)
Attachment #435827 - Flags: review?(vladimir)
Attachment #435827 - Flags: review+
Comment on attachment 435827 [details] [diff] [review]
Patch

looks fine to me, though would like :bs to sr this since it's in xre code
Attachment #435827 - Flags: superreview?(benjamin) → superreview+
Keywords: checkin-needed
Assignee: nobody → mh+mozilla
Status: NEW → ASSIGNED
http://hg.mozilla.org/mozilla-central/rev/dfca7a38cb50
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a5
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: