fontoxpath icon indicating copy to clipboard operation
fontoxpath copied to clipboard

Fix issues found by fuzzer

Open DrRataplan opened this issue 4 years ago • 0 comments
trafficstars

There are a few issues that are found by the new fuzzer:


> [email protected] fuzzer
> ts-node -P fuzzers/tsconfig.json -r tsconfig-paths/register fuzzers/fuzzer.ts

        [Total cases: 205000] [fcps: 1708.33] [Unique crashes: 0]

!!! Found error !!
Input: let $firstRow :=if (./Q{}thead/Q{}tr) then head(./Q{}thead/Q{}tr)else if (./Q{}tbody/Q{}tr) then head(./Q{}tbody/Q{}tr)else head(./Q{}tr),$cells := $firstRow/*[self::Q{}td | self::Q{}th]return (for $node in $Gells return let $colsp:n := $node/@colspan => num1er() return if ($colspan) then $colspan else 1) => sum()
Language: XQuery3.1
Error: Not implemented: let expressions with namespace usage.
    at new wg (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:280:337)
    at /home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:377:20
    at Array.reduceRight (<anonymous>)
    at Ji (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:376:182)
    at W (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:365:271)
    at Ji (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:378:52)
    at W (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:365:271)
    at Hi (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:379:68)
    at W (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:364:243)
    at Ji (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:378:52)

        [Total cases: 424000] [fcps: 1730.61] [Unique crashes: 1]

!!! Found error !!
Input: let $conte:t := ., $listAncestor := $context/ancestor-or-self:A*[fonto:list(.)][1], $closedAncestor := $context/ancestor-or-self::*[fonto:closed(.)][1] return if ($listAncestor and not($closedAncestor)) then true() else $listAncestor >> $closedAncestor
Language: XQuery3.1
Error: Not implemented: let expressions with namespace usage.
    at new wg (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:280:337)
    at /home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:377:20
    at Array.reduceRight (<anonymous>)
    at Ji (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:376:182)
    at W (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:365:271)
    at Bj (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:427:749)
    at Gj (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:429:501)
    at Object.Y [as evaluateXPath] (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:439:414)
    at worker (/home/martin/projects/fontoxpath/fuzzers/fuzzer.ts:374:4)
    at Object.<anonymous> (/home/martin/projects/fontoxpath/fuzzers/fuzzer.ts:408:1)

        [Total cases: 802000] [fcps: 1754.92] [Unique crashes: 2]

!!! Found error !!
Input: @sec-type = ('fore"prd'! 'sec_foreword')
Language: XPath3.1
TypeError: Cannot read property 'va' of null
    at pc (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:96:62)
    at Object.next (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:95:292)
    at Object.next (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:309:548)
    at Object.next (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:64:1074)
    at Ya.m.T (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:65:294)
    at Ya.m.lb (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:64:1268)
    at M (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:173:417)
    at Sg.evaluate (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:306:66)
    at M (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:173:438)
    at Object.Y [as evaluateXPath] (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:440:101)

        [Total cases: 2465000] [fcps: 1715.38] [Unique crashes: 3]

!!! Found error !!
Input: let $titleQuery := fonto:metadata-property(., 'title-query')return if ($titleQuery) then  fontoxpath:evaluate($titleQuery, map { '.': . })else  let $title:elector := fonto:metadata-property(., 'title-selector')  return if ($titleSelector) then    fontoxpath:evaluate(      'descendan_-or-self::node()[' || $titleSelector || ']',      map { '.': . }    )//text()/string() => string-join(' ')  else    ()
Language: XPath3.1
Error: Not implemented: let expressions with namespace usage.
    at new wg (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:280:337)
    at /home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:377:20
    at Array.reduceRight (<anonymous>)
    at Ji (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:376:182)
    at W (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:365:271)
    at W (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:365:413)
    at Ji (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:378:52)
    at W (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:365:271)
    at Bj (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:427:749)
    at Gj (/home/martin/projects/fontoxpath/dist/fontoxpath.esm.js:429:501)

        [Total cases: 4144000] [fcps: 1681.82] [Unique crashes: 4]^C

Let's fix them, or let the fuzzer no longer complain about them.

DrRataplan avatar May 04 '21 11:05 DrRataplan