mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-05-05 09:50:54 -05:00
SedRegex: add test for ReDoS timeout
This commit is contained in:
parent
e5af479939
commit
81debc45ec
@ -173,6 +173,14 @@ class SedRegexTestCase(ChannelPluginTestCase):
|
|||||||
m = self.getMsg(' ')
|
m = self.getMsg(' ')
|
||||||
self.assertIn('Segmentation fault (core dumped)', str(m))
|
self.assertIn('Segmentation fault (core dumped)', str(m))
|
||||||
|
|
||||||
|
def testReDoSTimeout(self):
|
||||||
|
# From https://snyk.io/blog/redos-and-catastrophic-backtracking/
|
||||||
|
for idx in range(500):
|
||||||
|
self.feedMsg("ACCCCCCCCCCCCCCCCCCCCCCCCCCCCX")
|
||||||
|
self.feedMsg(r"s/A(B|C+)+D/this should abort/")
|
||||||
|
m = self.getMsg(' ', timeout=1)
|
||||||
|
self.assertIn('timed out', str(m))
|
||||||
|
|
||||||
# TODO: test ignores
|
# TODO: test ignores
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user