Closed Bug 363057 Opened 18 years ago Closed 18 years ago

Silent ignoring of out-of-memory in jslock.c

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: igor, Assigned: igor)

References

Details

Attachments

(1 file, 3 obsolete files)

Currently, when js_UndependString fails due to faile malloc, jslock.c does not report its failure and instead tries to implement a workaround to recover from this. It would be nice if the failure would be at least reported if not propagated.
Blocks: 363059
Attached patch Fix v1 (obsolete) — Splinter Review
The patch changes the code to pass JSContext *cx to MakeStringImmutable in jslock.c on all code paths so js_UndependString receives cx, not NULL.
Attachment #248744 - Flags: review?(brendan)
Attached patch Fix v2 (obsolete) — Splinter Review
This version removes FIXME comments for this bug and wraps js_Dequeue inside NSPR_LOCK macros so GCC would not complain about a declared but never used function.
Attachment #248744 - Attachment is obsolete: true
Attachment #248746 - Flags: review?(brendan)
Attachment #248744 - Flags: review?(brendan)
Comment on attachment 248746 [details] [diff] [review]
Fix v2

Looks good, thanks -- worth a comment that only only OOM is usefully reported, since other errors turn into exceptions which are lost due to lack of propagated false return from js_FinishSharingScope?

/be
Attachment #248746 - Flags: review?(brendan) → review+
Attached patch Fix v2b (obsolete) — Splinter Review
Better comments in js_FinishSharingScope.
Attachment #248746 - Attachment is obsolete: true
Attachment #248756 - Flags: review?(brendan)
Comment on attachment 248756 [details] [diff] [review]
Fix v2b

>+             * FIXME bug 363059: The following error recovery changes the
>+             * execution semantic arbitrary and silently ignores any errors
>+             * except out-of-memory which should be already reported through
>+             * JS_ReportOutOfMemory at this point.

Comma before "which", and "have been reported" rather than "be already reported", and r=me.

/be
Attachment #248756 - Flags: review?(brendan) → review+
Attached patch Fix v2cSplinter Review
Patch to commit with English usage fixes.
Attachment #248756 - Attachment is obsolete: true
Attachment #248797 - Flags: review+
I committed the patch from comment 6 to the trunk:

Checking in jsapi.c;
/cvsroot/mozilla/js/src/jsapi.c,v  <--  jsapi.c
new revision: 3.295; previous revision: 3.294
done
Checking in jslock.c;
/cvsroot/mozilla/js/src/jslock.c,v  <--  jslock.c
new revision: 3.60; previous revision: 3.59
done
Checking in jslock.h;
/cvsroot/mozilla/js/src/jslock.h,v  <--  jslock.h
new revision: 3.33; previous revision: 3.32
done
Checking in jsstr.c;
/cvsroot/mozilla/js/src/jsstr.c,v  <--  jsstr.c
new revision: 3.137; previous revision: 3.136
done
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Flags: in-testsuite-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: