Closed Bug 465886 Opened 17 years ago Closed 14 years ago

TM: realloc is being used incorrectly

Categories

(Core :: JavaScript Engine, defect, P2)

x86
Windows XP
defect

Tracking

()

RESOLVED WONTFIX
Tracking Status
fennec 1.0- ---

People

(Reporter: timeless, Assigned: gal)

References

()

Details

(Keywords: crash, memory-leak)

Attachments

(1 file)

if realloc fails, it will return null, leaving the current data unchanged. correct usage is: void *x = malloc(1000); ... void *y = realloc(x, 100000); if (!y) { error(); } else { x = y; } also, it'd be nice if you actually handled failure.
Summary: realloc is being used incorrectly → TM: realloc is being used incorrectly
Assignee: general → gal
Severity: critical → major
Flags: blocking1.9.1?
Priority: -- → P3
Attached patch beginningsSplinter Review
the JS_Assert call is where i got stuck, it's not meant to be committed, although in a pinch it could go now, it just means that when we fail there, we must kill ourselves (no choice). i'm told some functions are dead/walking dead, that's ok.
Attachment #349254 - Flags: review?(gal)
Flags: blocking1.9.1? → blocking1.9.1+
Blocks: 465784
This is just a sanity check... While we're on the subject, when memory is free'ed via free(ptr), is ptr set to NULL/0/null as well. The double free memory problem is almost impossible to debug. malloc/realloc/free could all be implemented as macros to ensure consistent use of the idioms.
> While we're on the subject, when memory is free'ed via free(ptr), is ptr set to > NULL/0/null as well. Is that a question? If so, the answer is "no".
P2 ... just for you beltzner ;)
Priority: P3 → P2
Not sure this bug needs to block final. Maybe discuss and re-triage? A better fix would be some engine or browser-wide red zone allocation thing (ballast).
tracking-fennec: --- → ?
Flags: blocking1.9.1+
tracking-fennec: ? → 1.0-
Flags: wanted-fennec1.0+
Obsolete with the removal of tracejit.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → WONTFIX
Attachment #349254 - Flags: review?(gal)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: