Closed Bug 380016 Opened 17 years ago Closed 17 years ago

Catchguard decompilation includes "/*EXCEPTION*/"

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: jruderman, Assigned: mrbkap)

References

Details

(Keywords: regression, testcase)

Attachments

(2 files, 2 obsolete files)

js> function() { try { } catch(e if x) { } } 
function () {
    try {
    } catch (e if x) {
        /*EXCEPTION*/;
    }
}
bug 379860 is at fault here.
Blocks: 379860
test js1_5/Regress/regress-346494.js covers this.
Flags: in-testsuite+
ditto 
js1_5/extensions/regress-374589.js
js1_7/decompilation/regress-355105.js
js1_7/decompilation/regress-375794.js
The problem here is that an unannotated JSOP_POP simply decompiles whatever's on the stack. In this case, we want to really pop the exception cookie. It appears that we need to annotate the JSOP_POP emitted for the catchguard (for the DUP, I think) in some way so the decompiler simply pops and throws away the result.
Attached patch Something like this (obsolete) — Splinter Review
Assignee: general → mrbkap
Status: NEW → ASSIGNED
Attachment #264380 - Flags: review?(igor)
Comment on attachment 264380 [details] [diff] [review]
Something like this

Even easier: check for exception_cookie in the default JSOP_POP code and discard it. There's no way to generate such a comment that the decompiler could pop.

/be
Attached patch Easier (obsolete) — Splinter Review
Attachment #264380 - Attachment is obsolete: true
Attachment #264393 - Flags: review?(igor)
Attachment #264380 - Flags: review?(igor)
Comment on attachment 264393 [details] [diff] [review]
Easier

Sorry for driving by again: one thought is to exclude all non-empty strings that start with "/*".

/be
Comment on attachment 264393 [details] [diff] [review]
Easier

I would prefer comments explaining why empty string and the exception cookie are special.
(In reply to comment #8)
> (From update of attachment 264393 [details] [diff] [review])
> Sorry for driving by again: one thought is to exclude all non-empty strings
> that start with "/*".

I would prefer to keep the check as in Blake's patch but add an assert after it to ensure that the string does not start from "/*" or any other invalid chars at that point.
(In reply to comment #10)
> (In reply to comment #8)
> > (From update of attachment 264393 [details] [diff] [review] [details])
> > Sorry for driving by again: one thought is to exclude all non-empty strings
> > that start with "/*".
> 
> I would prefer to keep the check as in Blake's patch but add an assert after it
> to ensure that the string does not start from "/*" or any other invalid chars
> at that point.

Yeah, I considered that but tilted back toward silently popping any cookie. On reflection your preferred plan seems best to me, though.

/be
(In reply to comment #11)
> Yeah, I considered that but tilted back toward silently popping any cookie. On
> reflection your preferred plan seems best to me, though.

An alternative is to check for /* and then assert that is the exception cookie.
(In reply to comment #12)
> (In reply to comment #11)
> > Yeah, I considered that but tilted back toward silently popping any cookie. On
> > reflection your preferred plan seems best to me, though.
> 
> An alternative is to check for /* and then assert that is the exception cookie.

Best yet ;-).

/be
OS: Mac OS X → All
Hardware: PC → All
I think this is the smallest patch that has the desired behavior.
Attachment #264393 - Attachment is obsolete: true
Attachment #265168 - Flags: review?(brendan)
Attachment #264393 - Flags: review?(igor)
Comment on attachment 265168 [details] [diff] [review]
With the assertion

>+                    if (*rval != '\0' && (rval[0] != '/' || rval[1] != '*')) {
>+

Nit: lose this blank line.

r=me with that.

/be
Attachment #265168 - Flags: review?(brendan) → review+
This was checked in on trunk.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
verified fixed 1.9.0 linux/mac*/windows.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: