Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty description lists throw error #56

Closed
sebix opened this issue Oct 2, 2017 · 3 comments
Closed

Empty description lists throw error #56

sebix opened this issue Oct 2, 2017 · 3 comments

Comments

@sebix
Copy link
Member

sebix commented Oct 2, 2017

I played a bit with the american fuzzy lop (afl) :)

The examples used for afl are all copied from the examples on the website. It found this issue:

- :=
-

it throws:

Traceback (most recent call last):
  File "/home/ele/tmp/pyfuzz/code3.py", line 8, in <module>
    textile.textile(sys.stdin.read())
  File "/usr/lib/python3.6/site-packages/textile/core.py", line 1415, in textile
    return Textile(html_type=html_type).parse(text)
  File "/usr/lib/python3.6/site-packages/textile/core.py", line 248, in parse
    text = self.block(text)
  File "/usr/lib/python3.6/site-packages/textile/core.py", line 499, in block
    block = Block(self, tag, atts, ext, cite, line)
  File "/usr/lib/python3.6/site-packages/textile/objects/block.py", line 32, in __init__
    self.process()
  File "/usr/lib/python3.6/site-packages/textile/objects/block.py", line 125, in process
    self.content = self.textile.graf(self.content)
  File "/usr/lib/python3.6/site-packages/textile/core.py", line 645, in graf
    text = self.redcloth_list(text)
  File "/usr/lib/python3.6/site-packages/textile/core.py", line 1177, in redcloth_list
    return pattern.sub(self.fRCList, text)
  File "/usr/lib/python3.6/site-packages/textile/core.py", line 1188, in fRCList
    atts, content = m.groups()
AttributeError: 'NoneType' object has no attribute 'groups'
@sebix
Copy link
Member Author

sebix commented Oct 2, 2017

I ran the tests with python3 and using version 2.3.3 (which had more bugs), I need to rerun it with a current version.

@ikirudennis
Copy link
Member

ikirudennis commented Oct 2, 2017

This kind of seems like an upstream bug. txstyle only returns:

<dl>
</dl>

If you find more, I'd recommend just posting only the situations where php-textile returns something useful where we fail or don't match. Otherwise, isn't this more like a "garbage in/garbage out" situation?

edit: We should probably fix it so that it doesn't bomb, but it's hard to say what the fix should be given that even php-textile's output isn't particularly helpful.

@sebix
Copy link
Member Author

sebix commented Oct 3, 2017

I think that the function should never fail, even if the input does not make sense. If the input is nonsense, the output can be nonsense too, yes.

php-textile doesn't fail too, it gives an empty list, that's ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants