elvish/pkg
Qi Xiao 9cda3f643e parse: Fix a O(2^n) code path when input is "(" repeated n times.
The parsing function for Form first tries to parse a temp assignment, and
backtracks when an assignment cannot be parsed. When the input is "(" repeated n
times, each level of Form parsing will first try to parse the rest of the code
as an assignment and then backtrack, without making any progress. This results
in a call tree with a branching factor of 2, hence the O(2^n) complexity.

The fix is to first try to parse a head instead, and only try to parse it as a
temp assignment if it does contain "=". This fixes this particular pathological
case, although I'm not 100% sure it eliminates all possibilities of O(2^n) time
complexity.

With the introduction of the "tmp" special command, the current syntax for
temporary assignments will be deprecated and eventually go away, which will
eliminate all backtracking in the parser. In the meanwhile, this fix may be good
enough.

This case was discovered with fuzzing support in Go 1.18. Also add the fuzzing
test data.
2022-01-01 22:20:03 +00:00
..
buildinfo Bump version and deprecation level 2021-12-06 00:30:36 +00:00
cli Properly clear the filter when ascending or descending in nav mode. 2021-12-30 12:58:34 +00:00
daemon pkg/daemon: Always quit after receiving a signal. 2021-10-23 18:39:55 +01:00
diag More error deduplication 2021-06-06 14:54:47 +01:00
edit pkg/eval/vals: Add ReprPlain, Repr without pretty-printing. 2021-12-31 21:05:07 +00:00
env Implement XDG directory support. 2021-07-10 02:20:59 +01:00
eval Fix build on Go 1.16. 2021-12-31 21:13:41 +00:00
fsutil Fixup for #1394 2021-08-30 09:02:06 +01:00
getopt pkg/getopt: Revamp the API and implementation. 2021-12-31 14:36:01 +00:00
glob Replace remaining deprecated ioutil.ReadDir uses 2021-08-30 08:57:34 +01:00
logutil Remove most uses of the ioutil package. 2021-08-23 00:36:26 +01:00
mods pkg/eval/vals: Add ReprPlain, Repr without pretty-printing. 2021-12-31 21:05:07 +00:00
parse parse: Fix a O(2^n) code path when input is "(" repeated n times. 2022-01-01 22:20:03 +00:00
persistent Fix "indicies" -> indices. 2021-08-22 23:31:26 +01:00
prog Bump version and deprecation level 2021-12-06 00:30:36 +00:00
rpc Copy and trim down the net/rpc package. 2021-01-30 23:56:58 +00:00
shell pkg/mods: Import pkg/mods/unix. 2021-12-17 00:50:53 +00:00
store Expose all functionalities of the persistent store in the store: module. 2021-10-03 16:34:52 +01:00
strutil Handle all-cap abbreviations in strutil.CamelToDashed. 2021-12-31 16:54:32 +00:00
sys Fix cmd/examples/win_tty 2021-10-02 22:44:54 +01:00
testutil pkg/testutil: ScaledMs -> Scaled, takes a time.Duration instead. 2021-10-05 01:02:54 +01:00
tt pkg/eval/vals: Move the "any" matcher to pkg/tt. 2020-01-06 23:19:00 +00:00
ui Fix typos and add codespell to CI 2021-08-22 23:07:34 +01:00
wcwidth Improve the wcwidth package. 2021-02-11 00:47:21 +00:00