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

OutOfMemoryException on unrecognised template #535

Closed
anth12 opened this issue Dec 13, 2022 · 0 comments
Closed

OutOfMemoryException on unrecognised template #535

anth12 opened this issue Dec 13, 2022 · 0 comments
Labels

Comments

@anth12
Copy link

anth12 commented Dec 13, 2022

Describe the bug

When attempting to compile a template that is unrecognised, the thread is blocked and eventually throws an OutOfMemoryException.

Expected behaviour:

The template parsing should either ignore the unsupported syntax or throw an "unsupported exception".

Test to reproduce

        [Fact]
        public void Compile_UnrecognisedExpression_ThrowsOutOfMemory()
        {
            var handlebars = Handlebars.Create();

            var source = "{{Text | example}}";

            Assert.Throws<OutOfMemoryException>(()=> handlebars.Compile(source));
        }

Other related info

My use-case for a templating library is to render HTML emails where templates are maintained by content editors. The above syntax is used by SendGrid to default values hence it's usage with Handlebars.Net.


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

No branches or pull requests

2 participants