Skip to content

2.6.11 Hangs with nested square bracket #777

Closed

Description

@heqingy

I was investigating a Zulip hang, and found this issue

>>> m = markdown.Markdown()
>>> a = '''[ [ -99966.00320, 1048576 ][ -99966.00320, 1048577 ][ -99969.00352, 1048576 ][ -99969.00352, 1048577 ][ -99966.00320, 1048582 ][ -99966.00320, 1048584 ][ -99969.00352, 1048585 ] ]'''
>>> m.convert(a)

it hangs

I can ctrl+c to show the stacktrace:

Traceback:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/srv/zulip-venv-cache/db2e19acf380c215acb64d21fd54f7f3ec3dac98/zulip-py3-venv/lib/python3.6/site-packages/markdown/__init__.py", line 375, in convert
    newRoot = treeprocessor.run(root)
  File "/srv/zulip-venv-cache/db2e19acf380c215acb64d21fd54f7f3ec3dac98/zulip-py3-venv/lib/python3.6/site-packages/markdown/treeprocessors.py", line 324, in run
    self.__handleInline(text), child
  File "/srv/zulip-venv-cache/db2e19acf380c215acb64d21fd54f7f3ec3dac98/zulip-py3-venv/lib/python3.6/site-packages/markdown/treeprocessors.py", line 107, in __handleInline
    data, patternIndex, startIndex)
  File "/srv/zulip-venv-cache/db2e19acf380c215acb64d21fd54f7f3ec3dac98/zulip-py3-venv/lib/python3.6/site-packages/markdown/treeprocessors.py", line 239, in __applyPattern
    match = pattern.getCompiledRegExp().match(data[startIndex:])

3.0.1 resolves the issue, but many projects cannot upgrade to 3.0 right away. Any proposed fix?

Activity

  1. waylan commented on Jan 10, 2019

    @waylan
    Member

    I suspect the fix you mention happened in #629 which was a complete refactor of how inline parsing works. There is no way to backport the changes to the link parser (which parses nested brackets) to any earlier versions of Markdown. Sorry, but to benefit from those changes, you will need to update to 3,0.

    Even if a minimal backport could be made, it's not likely that we would. We maintain Python-Markdown as volunteers in our limited spare time and we are not able to offer long-term support for older versions. We are only able to maintain the latest release. See the Contributing Guide for our version workflow.

  2. added
    wontfix
    on Jan 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions