[Bug 576590] Re: Command not found consumes lots of memory and CPU for longer input
*** This bug is a duplicate of bug 1643167 *** https://bugs.launchpad.net/bugs/1643167 ** This bug has been marked a duplicate of bug 1643167 command-not-found crash on inreasonably long input -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/576590 Title: Command not found consumes lots of memory and CPU for longer input To manage notifications about this bug go to: https://bugs.launchpad.net/command-not-found/+bug/576590/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 576590] Re: Command not found consumes lots of memory and CPU for longer input
The bug still exists in Ubuntu 16.04. The examples below use a 1 GB memory limit. 3000-character input: 17 seconds, no crash. 4000-character input: 0.8 seconds, MemoryError crash. $ (ulimit -v 100; time /usr/lib/command-not-found -- "$(python -c 'print "x"*3000')") xx x x : command not found real0m17.407s user0m17.008s sys 0m0.388s $ (ulimit -v 100; time /usr/lib/command-not-found -- "$(python -c 'print "x"*4000')") Sorry, command-not-found has crashed! Please file a bug report at: https://bugs.launchpad.net/command-not-found/+filebug Please include the following information with the report: command-not-found version: 0.3 Python version: 3.5.2 final 0 Distributor ID: Ubuntu Description:Ubuntu 16.04.3 LTS Release:16.04 Codename: xenial Exception information: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/CommandNotFound/util.py", line 24, in crash_guard callback() File "/usr/lib/command-not-found", line 90, in main if not cnf.advise(args[0], options.ignore_installed) and not options.no_failure_msg: File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 267, in advise self.print_spelling_suggestion(command) File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 143, in print_spelling_suggestion for w in similar_words(word): File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 103, in similar_words inserts = [a + c + b for a, b in s for c in alphabet] File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 103, in inserts = [a + c + b for a, b in s for c in alphabet] MemoryError real0m0.766s user0m0.320s sys 0m0.440s -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/576590 Title: Command not found consumes lots of memory and CPU for longer
[Bug 576590] Re: Command not found consumes lots of memory and CPU for longer input
** Changed in: command-not-found Status: Confirmed = Fix Released ** Changed in: command-not-found (Ubuntu) Status: Confirmed = Fix Released -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/576590 Title: Command not found consumes lots of memory and CPU for longer input To manage notifications about this bug go to: https://bugs.launchpad.net/command-not-found/+bug/576590/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 576590] Re: Command not found consumes lots of memory and CPU for longer input
I temporarily fixed my own installation of cnf by changing line 89 of /usr/lib/command-not-found from: if len(args) == 1: to if len(args) == 1 and len(args[0])100: That means cnf will not do anything for commands longer than 100 characters. But seriously, can anyone tell me a command that has 100 characters? This bug can be used by an attacker to bring down a system to its knees. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/576590 Title: Command not found consumes lots of memory and CPU for longer input To manage notifications about this bug go to: https://bugs.launchpad.net/command-not-found/+bug/576590/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 576590] Re: Command not found consumes lots of memory and CPU for longer input
** Changed in: command-not-found (Ubuntu) Status: New = Confirmed -- Command not found consumes lots of memory and CPU for longer input https://bugs.launchpad.net/bugs/576590 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs