Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse5 'endTagInBody' causes stack overflow when loading certain documents #1778

Closed
wchaering opened this issue Mar 19, 2017 · 3 comments · Fixed by #1849
Closed

Parse5 'endTagInBody' causes stack overflow when loading certain documents #1778

wchaering opened this issue Mar 19, 2017 · 3 comments · Fixed by #1849

Comments

@wchaering
Copy link

Possible to upgrade to a later version of Parse5? I see this is using an older version.

@inikulin
Copy link
Contributor

Hi @wchaering,
Can you provide markup that causes the error?

@wchaering
Copy link
Author

Thanks for replying so quickly @inikulin ! Absolutely--here is the document I am loading: https://www.thoughtco.com/supercomputers-tech-weather-forecasting-tools-4120844

My configuration object, in case it's helpful:

{
  url: 'https://www.thoughtco.com/supercomputers-tech-weather-forecasting-tools-4120844',
  scripts: ["https://code.jquery.com/jquery-3.1.1.slim.min.js"],
  headers: {
    Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
  }
}

Also the error:

RangeError: Maximum call stack size exceeded
    at genericEndTagInBody (/Users/wchaering/Code/scraping-test/node_modules/parse5/lib/tree_construction/parser.js:1887:29)
at Object.endTagInBody [as END_TAG_TOKEN] (/Users/wchaering/Code/scraping-test/node_modules/parse5/lib/tree_construction/parser.js:2002:17)
    at Parser._processToken (/Users/wchaering/Code/scraping-test/node_modules/parse5/lib/tree_construction/parser.js:619:38)
at parser._processToken (/Users/wchaering/Code/scraping-test/node_modules/parse5/lib/tree_construction/location_info_mixin.js:89:35)
    at Parser._processFakeEndTag (/Users/wchaering/Code/scraping-test/node_modules/parse5/lib/tree_construction/parser.js:663:10)
    at buttonStartTagInBody (/Users/wchaering/Code/scraping-test/node_modules/parse5/lib/tree_construction/parser.js:1351:11)
...
^ 'at buttonStartTagInBody' line repeats

@inikulin
Copy link
Contributor

inikulin commented Mar 19, 2017

I confirm that it was fixed a long time ago in parse5 via inikulin/parse5@15e0321

domenic pushed a commit that referenced this issue May 14, 2017
Fixes #1778.

This changes the public API in that the nodeLocation() functions now return differently-structured objects. parse5 has also removed support for serialization of obsolete doctypes.

#1316 is a more ambitious attempt to use parse5's new streaming interface to get correct script execution semantics, but is still not ready; this is just a minimal upgrade to the latest parse5 version.
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 a pull request may close this issue.

2 participants