FontoXML / fontoxpath

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

Cannot read property 'ta' of null crashes in various functions #351

Open devatwork opened 3 years ago

devatwork commented 3 years ago

Found by #349

Selector: math:pow(-2.5!0, 2.0e0) Language: XPath3.1

TypeError: Cannot read property 'ta' of null
    at Sg (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:94:62)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:93:300)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:263:551)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:58:985)
    at Xc.E.U (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:59:294)
    at Xc.E.jb (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:58:1179)
    at ok (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:164:419)
    at un.evaluate (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:247:58)
    at Array.<anonymous> (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:177:781)
    at C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:179:76
devatwork commented 3 years ago

Same error, slightly different stack trace, probably some issue.

!!! Crash found !!! Selector: fn:round-half-to-even(3.5678!2<+3, 2) Language: XQueryUpdate3.1

TypeError: Cannot read property 'ta' of null
    at Sg (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:94:62)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:93:300)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:263:551)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:58:985)
    at Xc.E.U (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:59:294)
    at Xc.E.jb (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:58:1179)
    at ok (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:164:419)
    at Fn.evaluate (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:260:50)
    at Array.<anonymous> (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:177:781)
    at C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:179:76
devatwork commented 3 years ago

Idem:

!!! Crash found !!! Selector: array:head([["a", "b"]! ["c", "d"]]) Language: XPath3.1

TypeError: Cannot read property 'ta' of null
    at Sg (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:94:62)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:93:300)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:263:551)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:58:985)
    at Xc.E.U (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:59:294)
    at Xc.E.jb (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:58:1179)
    at ok (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:164:419)
    at C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:219:889
    at Array.map (<anonymous>)
    at Bm.evaluate (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:219:863)
devatwork commented 3 years ago

Idem

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

TypeError: Cannot read property 'ta' of null
    at Sg (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:94:62)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:93:300)
    at Object.next (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:263:551)
    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.U (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:59:294)
    at Xc.E.jb (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:58:1179)
    at ok (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:164:419)
    at fs.evaluate (C:\fontoxml\platform\fontoxpath\dist\fontoxpath.esm.js:276:50)