Skip to content

OutOfMemoryException on unrecognised template #535

Closed

Description

@anth12

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions