Skip to content

Parsing error with EOL + comment in place of semicolon - #13

Merged
hns merged 1 commit into
mozilla:masterfrom
HtmlUnit:master
Nov 9, 2011
Merged

hns merged 1 commit into
mozilla:masterfrom
HtmlUnit:master

Conversation

@mguillem

Copy link
Copy Markdown
Contributor

code like this
var s = 3
/* */var t = 1;
can't be parsed. Exception below is thrown. Pull request contains unit test + fix.

junit.framework.AssertionFailedError: extra error: missing ; before statement
at junit.framework.Assert.fail(Assert.java:47)
at org.mozilla.javascript.testing.TestErrorReporter.error(TestErrorReporter.java:38)
at org.mozilla.javascript.Parser.addError(Parser.java:230)
at org.mozilla.javascript.Parser.addError(Parser.java:208)
at org.mozilla.javascript.Parser.reportError(Parser.java:265)
at org.mozilla.javascript.Parser.reportError(Parser.java:252)
at org.mozilla.javascript.Parser.reportError(Parser.java:245)
at org.mozilla.javascript.Parser.autoInsertSemicolon(Parser.java:1109)
at org.mozilla.javascript.Parser.statementHelper(Parser.java:1086)
at org.mozilla.javascript.Parser.statement(Parser.java:943)
at org.mozilla.javascript.Parser.parse(Parser.java:568)
at org.mozilla.javascript.Parser.parse(Parser.java:530)
at org.mozilla.javascript.tests.ParserTest.parseAsReader(ParserTest.java:977)
at org.mozilla.javascript.tests.ParserTest.testParseAutoSemiColonBeforeNewlineAndComments(ParserTest.java:34)

hns added a commit that referenced this pull request Nov 9, 2011
Parsing error with EOL + comment in place of semicolon
@hns
hns merged commit fd4eb6a into mozilla:master Nov 9, 2011
anivar added a commit to anivar/rhino that referenced this pull request Dec 18, 2025
…de overflow, and codepoints

Fixed 4 additional MEDIUM priority security issues:

Issue mozilla#12: Added validation in build() to prevent bitmap size overflow
- Check length is non-negative and within MAX_CODE_POINT range
- Check for integer overflow in byteLength calculation

Issue mozilla#13: Added validation in addCharacterRange() to check both c1 and c2
before calculating byte indices to prevent out-of-bounds access

Issue mozilla#14: Added overflow check in emitREBytecode() before writing to
program array to prevent bytecode buffer overflow

Issue mozilla#16: Added codepoint validation in classMatcher() to ensure codepoint
is within valid Unicode range (0 to MAX_CODE_POINT)

All fixes add defensive validation without changing functionality.
Tests pass successfully.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants