Issue 11472

Title
SAO DomainParser gets caught in infinite loop
Priority
bug
Status
resolved
Nosy list
ced, hodeinavarro, pokoli, reviewbot, roundup-bot
Assigned to
ced
Keywords
review

Created on 2022-05-09.15:46:18 by hodeinavarro, last changed 6 months ago by roundup-bot.

Messages

New changeset f3de06c9168d by Cédric Krier in branch '6.4':
Test for sub-domain instead of not leaf in domain parser
https://hg.tryton.org/sao/rev/f3de06c9168d

New changeset 45e2c8de9e20 by Cédric Krier in branch '6.2':
Test for sub-domain instead of not leaf in domain parser
https://hg.tryton.org/sao/rev/45e2c8de9e20

New changeset d2a5f3cf8da6 by Cédric Krier in branch '6.0':
Test for sub-domain instead of not leaf in domain parser
https://hg.tryton.org/sao/rev/d2a5f3cf8da6

New changeset 01f83a490bf9 by Cédric Krier in branch '5.0':
Test for sub-domain instead of not leaf in domain parser
https://hg.tryton.org/sao/rev/01f83a490bf9
New changeset 99924f9dd683 by Cédric Krier in branch 'default':
Test for sub-domain instead of not leaf in domain parser
https://hg.tryton.org/tryton-env/rev/99924f9dd683
New changeset 07fec0d45308 by Cédric Krier in branch 'default':
Add test for domain completion ending with or
https://hg.tryton.org/tryton/rev/07fec0d45308
New changeset 8e38c5eebb96 by Cédric Krier in branch 'default':
Test for sub-domain instead of not leaf in domain parser
https://hg.tryton.org/sao/rev/8e38c5eebb96
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-05-17.17:40:52

Here is review411171004 that solves the problem in a generic way.

Author: [hidden] (hodeinavarro)
Date: 2022-05-11.23:17:45

Go into any "FILTERS" text box and type a field with a value then as soon as you end the keyword "or" or "and" it will raise the mentioned exceptions.
Ex. go into Parties and type: "Name: Albright or"

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-05-11.23:12:35

Could you please provide a scenario to reproduce your problem?

Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2022-05-09.16:01:47

Thank you for raising the bug and provide a patch for it.

P.S: Please assign the issue to yourself if you plan to work on it ;-)

Author: [hidden] (hodeinavarro)
Date: 2022-05-09.15:46:18

https://hg.tryton.org/sao/file/6.4/src/common.js#l1453

ending_clause method evaluates incorrectly the is_leaf by returning True when last_element is not an instance of Array which is the reason a loop is created.

Tested on demo websites from 5.0 to 6.4, persists in all versions.

Firefox (crashes, so it's not noticed unless checking the console)

Uncaught InternalError: too much recursion

Chrome/Edge (crashes, so it's not noticed unless checking the console)

Uncaught RangeError: Maximum call stack size exceeded

Safari gets the window hang up and CPU utilization spikes up to 100%.

p.s: Thanks to Sergi that helped me to catch the bug and evaluate a possible fix quicker than if I sought to do it alone

History
Date User Action Args
2022-06-02 13:43:20roundup-botsetkeyword: - backport
messages: + msg76923
2022-05-19 21:59:01roundup-botsetmessages: + msg76723
2022-05-19 21:58:53roundup-botsetmessages: + msg76721
2022-05-19 21:58:48roundup-botsetmessages: + msg76719
nosy: + roundup-bot
status: testing -> resolved
2022-05-17 17:44:50reviewbotsetmessages: + msg76702
2022-05-17 17:40:52cedsetassignedto: hodeinavarro -> ced
messages: + msg76701
reviews: 431091003 -> 431091003,411171004
status: in-progress -> testing
2022-05-12 01:15:42cedlinkissue11477 superseder
2022-05-11 23:17:45hodeinavarrosetmessages: + msg76600
2022-05-11 23:12:35cedsetmessages: + msg76597
nosy: + ced
2022-05-11 21:25:08reviewbotsetmessages: + msg76596

Showing 10 items. Show all history (warning: this could be VERY long)