Skip to content

find() throws "Maximum call stack size exceeded" error #1316

@dtto86

Description

@dtto86

We are using cheerio npm package version ^1.0.0-rc.12 in our application to parse xml content. cheerio internally uses domutils version ^3.0.1.

When we tried to parse specific xml content using load() function of cheerio, load() function then internally calls find() of domutils where we observed following exception

RangeError: Maximum call stack size exceeded
    at Object.get [as isTag] (/home/xyz/cheerio-poc/node_modules/domhandler/lib/index.js:6:47)
    at Object.get [as isTag] (/home/xyz/cheerio-poc/node_modules/domutils/lib/index.js:27:100)
    at /home/xyz/cheerio-poc/node_modules/cheerio-select/lib/index.js:293:60
    at find (/home/xyz/cheerio-poc/node_modules/domutils/lib/querying.js:37:13)
    at find (/home/xyz/cheerio-poc/node_modules/domutils/lib/querying.js:43:28)
    at find (/home/xyz/cheerio-poc/node_modules/domutils/lib/querying.js:43:28)
    at find (/home/xyz/cheerio-poc/node_modules/domutils/lib/querying.js:43:28)
    at find (/home/xyz/cheerio-poc/node_modules/domutils/lib/querying.js:43:28)
    at find (/home/xyz/cheerio-poc/node_modules/domutils/lib/querying.js:43:28)
    at find (/home/xyz/cheerio-poc/node_modules/domutils/lib/querying.js:43:28)

Attaching sample code for your reference.
cheerio-poc.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions