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

Fix issues found by fuzzer #339

Open
DrRataplan opened this issue May 4, 2021 · 0 comments
Open

Fix issues found by fuzzer #339

DrRataplan opened this issue May 4, 2021 · 0 comments

Comments

@DrRataplan
Copy link
Collaborator

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


> fontoxpath@3.17.3 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.

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

No branches or pull requests

1 participant