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

SIGSEGV by env.render("{{ 1 + }}", data) #248

Closed
kubo opened this issue Jun 28, 2022 · 1 comment
Closed

SIGSEGV by env.render("{{ 1 + }}", data) #248

kubo opened this issue Jun 28, 2022 · 1 comment

Comments

@kubo
Copy link
Contributor

kubo commented Jun 28, 2022

I inserted the following line here and ran tests.

CHECK_THROWS_WITH(env.render("{{ 1 + }}", data), "???");

inja_test got SIGSEGV as follows.

$ ./inja_test 
[doctest] doctest version is "2.4.9"
[doctest] run with "--help" for options
===============================================================================
/home/kubo/inja/test/test-functions.cpp:3:
TEST CASE:  functions
  math

/home/kubo/inja/test/test-functions.cpp:3: FATAL ERROR: test case CRASHED: SIGSEGV - Segmentation violation signal

===============================================================================
/home/kubo/inja/test/test-functions.cpp:3:
TEST CASE:  functions

DEEPEST SUBCASE STACK REACHED (DIFFERENT FROM THE CURRENT ONE):
  math

===============================================================================
[doctest] test cases:  7 |  6 passed | 1 failed | 8 skipped
[doctest] assertions: 33 | 33 passed | 0 failed |
[doctest] Status: FAILURE!
Segmentation fault (core dumped)

Inserting the following code here fixes SIGSEGV.

    if (static_cast<int>(arguments.size()) < function->number_args) {
      throw_parser_error("too few arguments");
    }
@pantor
Copy link
Owner

pantor commented Jul 10, 2022

This is now fixed with the latest commit on master. I'll look at your PR shortly. Thanks so much!

@pantor pantor closed this as completed Jul 10, 2022
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