Closed Bug 9596 Opened 27 years ago Closed 27 years ago

[PP]Electric fence mod for mozilla/xpcom/typelib/xpt/tools/xpt_link

Categories

(Core :: XPConnect, defect, P3)

x86
Linux
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: kherron+mozilla, Assigned: mike+mozilla)

Details

Attachments

(1 file)

I modified the Mozilla build process to link everything with the electric fence library (a debugging memory-allocation lib) and got a hit on line 175 of xpt_link.c for an attempt to allocate 0 bytes. EF treats this as a potential bug and halts when this occurs. xpt_link was processing _xpidlgen/nsrootidl.xpt which contains 0 interfaces, so the program was attempting to allocate a 0-sized array to contain them. xpt_link as written has no problem with this, but it'd be nice for the build process to complete with EF in use, and it's easy to work around this problem. While inspecting the code I noted two other hypothetical problems: 1) If none of the input files contains interfaces, arrays IDE_array and fix_array will never be initialized. I don't know if this is actually likely. 2) calloc() et al. are allowed to return a real pointer to allocated memory in response to a request for 0 bytes. xpt_link could leak such an allocation. The attached patch corrects all three of these issues.
Assignee: rickg → mccabe
Looks like one for mccabe, based on cvs logs.
Status: NEW → ASSIGNED
Looks like a great patch. I have applied it to my tree, and everything still works. Awaiting a green tree to check it into. Marking as assigned.
Status: ASSIGNED → RESOLVED
Closed: 27 years ago
Resolution: --- → FIXED
Saw a tiny spot of green. Patch applied.
Summary: Electric fence mod for mozilla/xpcom/typelib/xpt/tools/xpt_link → [PP]Electric fence mod for mozilla/xpcom/typelib/xpt/tools/xpt_link
Target Milestone: M9
kherron, could you check out and set but to Verified now if all is well? Thanks!
Status: RESOLVED → VERIFIED
Component: XP Utilities → XPConnect
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: