FontoXML / fontoxpath

A minimalistic XPath 3.1 implementation in pure JavaScript
MIT License
131 stars 17 forks source link

Cannot read property 'nodeType' of undefined #355

Open devatwork opened 3 years ago

devatwork commented 3 years ago

Found by #349

!!! Crash found !!! Selector: fn:empty((1,2,3)[/0]) Language: XPath3.1

TypeError: Cannot read property 'nodeType' of undefined
    at bs.evaluate (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:273:714)
    at ok (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:164:440)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:277:7)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:58:985)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:61:253)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:58:985)
    at Xc.E.first (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:59:76)
    at Xc.E.G (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:60:376)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:62:153)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:58:985)
devatwork commented 3 years ago

!!! Crash found !!! Selector: string((1, 2! /)) Language: XPath3.1

TypeError: Cannot read property 'nodeType' of undefined
    at bs.evaluate (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:273:714)
    at ok (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:164:440)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:263:587)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:58:985)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:94:402)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:58:985)
    at Xc.E.ya (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:61:130)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:62:214)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:58:985)
    at Xc.E.first (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:59:76)
devatwork commented 3 years ago

!!! Crash found !!! Selector: fn:sum((1 to 100)[/tk0], 0) Language: XPath3.1

TypeError: Cannot read property 'nodeType' of undefined
    at bs.evaluate (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:273:714)
    at ok (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:164:440)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:277:7)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:58:985)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:61:253)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:58:985)
    at Xc.E.first (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:59:76)
    at Xc.E.G (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:60:376)
    at ud.mu [as value] (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:605:29)
    at C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:181:201
jarivm commented 3 years ago

The first error occurs in AbsolutePathExpression. Just the /0 part of fn:empty((1,2,3)[/0]) seems to be accepted in the XPath playground, resulting in 0. Anyway, I don't know what it is.