untitaker / rust-vobject

VObject parser and generator for Rust
https://docs.rs/vobject/
MIT License
16 stars 7 forks source link

Fix infinite loop with mismatched begin/end tags #12

Closed gnuish closed 7 years ago

gnuish commented 7 years ago

It is caused from the self.pos = begin.pos; right before the tags error is returned in consume_component(), causing the recursion to start from the beginning over and over.

As of right now, that begin.pos is useless because the public API just uses parse_component() (which creates a new Parser that's never re-used) and consume_component() is private, even though consume_property() is public.

Other changes in this PR are line folding (benched 10x faster on my machine and doesn't mess Unicode chars), and minor cleanups.

If anything needs changing let me know ✌️

gnuish commented 7 years ago

Removed commits that change the public API

untitaker commented 7 years ago

There's way more happing here than the bugfix in the title. Could you split that up?

gnuish commented 7 years ago

Done. Travis seems to be unable to upgrade nightly or something but it passes for stable and tests and builds fine.

untitaker commented 7 years ago

I chose a different way, as I want every consume function to roll back if parsing fails. Thanks though!