From kde-core-devel Thu Apr 18 13:09:58 2013 From: "Commit Hook" Date: Thu, 18 Apr 2013 13:09:58 +0000 To: kde-core-devel Subject: Re: Review Request 110027: kjs: Don't crash if code in with-statement causes a "pre"-exception Message-Id: <20130418130958.14081.44314 () vidsolbach ! de> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=136629064929960 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============7684549992136904048==" --===============7684549992136904048== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://git.reviewboard.kde.org/r/110027/#review31243 ----------------------------------------------------------- This review has been submitted with commit 137c4d58664657bc9e11068dc1a0ff739f06b121 by Bernd Buschinski to branch master. - Commit Hook On April 15, 2013, 3:44 p.m., Bernd Buschinski wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > http://git.reviewboard.kde.org/r/110027/ > ----------------------------------------------------------- > > (Updated April 15, 2013, 3:44 p.m.) > > > Review request for kdelibs. > > > Description > ------- > > For js code like: > with({}) { with({}) { with({}) { import x.x; } } } > > the import statement can cause an exception, the import-exception is generated (but not fired) before it executes the other code. > The With-statement has 2 operations to push and pop the new scope it should be used with. > As the pre-generated Exception is already present, PushScope checks that and does not Push a new Scope. > But PopScope does not check that, and tries to pop, which leads us to a crash. > The Scope should be cleared by the Exceptionhandler on exception case, and PopScope should do nothing. > > NOTE: I must admit I am unsure if this is the best solution, a review by a experienced kjs developer would be super helpful > > > This addresses bugs 311512 and 311513. > http://bugs.kde.org/show_bug.cgi?id=311512 > http://bugs.kde.org/show_bug.cgi?id=311513 > > > Diffs > ----- > > kjs/bytecode/codes.def 59fea6c > > Diff: http://git.reviewboard.kde.org/r/110027/diff/ > > > Testing > ------- > > Fixes the crash cases in the bugreport: > > {with({}) { import window.x; } M:do {with(NaN = y)NaN = 1.3; } while(0); } > try { with({}) /*TODE2*/if(window) { if (V) {continue ;; }} else import set.x; } finally { x.__proto__ = x; } > try { with({}) { import x.*; } } finally { return (x); } > with({}) { with({}) { with({}) { import x.x; } } } > > > and still keeps normal cases working like for example: > with({a:2}) { print(a); } > with(Math) { a= PI *2; print(a); } > > > Thanks, > > Bernd Buschinski > > --===============7684549992136904048== Content-Type: text/html; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit
This is an automatically generated e-mail. To reply, visit: http://git.reviewboard.kde.org/r/110027/

This review has been submitted with commit 137c4d58664657bc9e11068dc1a0ff739f06b121 by Bernd Buschinski to branch master.

- Commit


On April 15th, 2013, 3:44 p.m. UTC, Bernd Buschinski wrote:

Review request for kdelibs.
By Bernd Buschinski.

Updated April 15, 2013, 3:44 p.m.

Description

For js code like:
with({}) { with({}) { with({}) { import x.x; }  }  }

the import statement can cause an exception, the import-exception is generated (but not fired) before it executes the other code.
The With-statement has 2 operations to push and pop the new scope it should be used with.
As the pre-generated Exception is already present, PushScope checks that and does not Push a new Scope.
But PopScope does not check that, and tries to pop, which leads us to a crash.
The Scope should be cleared by the Exceptionhandler on exception case, and PopScope should do nothing.

NOTE: I must admit I am unsure if this is the best solution, a review by a experienced kjs developer would be super helpful

Testing

Fixes the crash cases in the bugreport:

{with({}) { import window.x; } M:do {with(NaN = y)NaN = 1.3; } while(0); }
try { with({}) /*TODE2*/if(window) { if (V) {continue ;; }} else import set.x; } finally { x.__proto__ = x; }
try { with({}) { import x.*; }  } finally { return (x); }
with({}) { with({}) { with({}) { import x.x; }  }  }


and still keeps normal cases working like for example:
with({a:2}) { print(a); }
with(Math) { a= PI *2; print(a); }
Bugs: 311512, 311513

Diffs

  • kjs/bytecode/codes.def (59fea6c)

View Diff

--===============7684549992136904048==--