Samsung / escargot

Escargot is a lightweight JavaScript engine designed specifically for resource-constrained environments.
GNU Lesser General Public License v2.1
269 stars 43 forks source link

An Issue with the && and || Operators #1283

Closed marccarigiet closed 11 months ago

marccarigiet commented 11 months ago

Escargot:

Describe the bug Some invalid Expressions involving && and || in combination with postfix operators do not throw an Error in Escargot

Test case Test code to reproduce the behavior:

 ! this && ++ ! var1;

Backtrace

False

Expected behavior I would expect an error to be thrown, as that is what the other JavaScript engines do that I ran this example on, which includes V8 and SpiderMonkey. Further, the following expressions do throw an error:

! this && ++ this;

Script parsing error: SyntaxError: Line 1: Invalid left-hand side in assignment

this && ++ ! this;

Uncaught ReferenceError: Invalid left-hand side in assignment:

Additional test cases that trigger the same behaviour

+ this && -- delete this  ;
- this && { } --  ;
delete this || -- typeof this  ;
this || ! ++ ~ this  ;
void this && -- void this  ;
~ this || { } ++  ;
clover2123 commented 11 months ago

@marccarigiet Thank you for reporting the issue. I will fix it as soon as possible. BTW can you tell me where you obtained these test codes? These codes seems useful in identifying undetected bugs within the Escargot engine :)

marccarigiet commented 11 months ago

@clover2123
Thanks for fixing :). The test codes were generated as part of my Bachelor's thesis, It would certainly be possible to provide you with either a set of test cases or the corresponding test case generator. I'll talk to my supervisor about it.

clover2123 commented 11 months ago

@marccarigiet Thank you! I'm looking forward to your positive response!