Skip to content

A possible bug about calling eval in strict mode #102

@YaoHouyou

Description

@YaoHouyou

Version: 3ed8340

Testcase:

var NISLFuzzingFunc = function() {
    "use strict";
    eval("var public = 1;");
};
NISLFuzzingFunc();

Command:

./build/bin/hermes -w testcase.js

Output:

Expected output:

Throw SyntaxError on Line 3

Description:

According to the ES standard, eval code is strict mode code if the call to eval is contained in strict mode code. In the testcase above, the eval code should be strict mode code, and the reserved word "public" cannot be used as a variable name in strict mode, so a SyntaxError should be thrown on Line 3. However, Hermes did not throw any exceptions when running the above testcase.
The reference of the ES standard is as follows:
http://www.ecma-international.org/ecma-262/6.0/index.html#sec-strict-mode-code

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions