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

Memory leaks reported by LeakSanatizer #2842

Closed
FireBurn opened this issue Dec 9, 2022 · 6 comments
Closed

Memory leaks reported by LeakSanatizer #2842

FireBurn opened this issue Dec 9, 2022 · 6 comments

Comments

@FireBurn
Copy link

FireBurn commented Dec 9, 2022

fireburn@axion ~/spoa-modsecurity $ ./modsecurity  -f modsecurity.conf -p 10010
^C
=================================================================
==423782==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 1152 byte(s) in 36 object(s) allocated from:
    #0 0x7f94a02e7938 in operator new(unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/12/libasan.so.8+0xe7938)
    #1 0x7f949ff07ed7 in yylex(modsecurity::Parser::Driver&) /var/tmp/portage/dev-libs/modsecurity-3.0.8/work/modsecurity-v3.0.8/src/seclang-scanner.ll:1260

Direct leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x7f94a02e7938 in operator new(unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/12/libasan.so.8+0xe7938)
    #1 0x7f949fecafab in yy::seclang_parser::parse() /var/tmp/portage/dev-libs/modsecurity-3.0.8/work/modsecurity-v3.0.8/src/seclang-parser.yy:322
    #2 0x7f949ff28713 in modsecurity::Parser::Driver::parse(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) parser/driver.cc:145

Direct leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x7f94a02e7938 in operator new(unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/12/libasan.so.8+0xe7938)
    #1 0x7f949ff2873c in modsecurity::Parser::Driver::parse(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) parser/driver.cc:134

Indirect leak of 3501 byte(s) in 36 object(s) allocated from:
    #0 0x7f94a02e7938 in operator new(unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/12/libasan.so.8+0xe7938)
    #1 0x7f949ff07f23 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/basic_string.tcc:225
    #2 0x7f949ff07f23 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/basic_string.h:544
    #3 0x7f949ff07f23 in yylex(modsecurity::Parser::Driver&) /var/tmp/portage/dev-libs/modsecurity-3.0.8/work/modsecurity-v3.0.8/src/seclang-scanner.ll:1260

Indirect leak of 17 byte(s) in 1 object(s) allocated from:
    #0 0x7f94a02e7938 in operator new(unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/12/libasan.so.8+0xe7938)
    #1 0x7f949ff287bc in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/basic_string.tcc:225
    #2 0x7f949ff287bc in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/basic_string.h:544
    #3 0x7f949ff287bc in modsecurity::Parser::Driver::parse(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) parser/driver.cc:134

SUMMARY: AddressSanitizer: 4734 byte(s) leaked in 75 allocation(s).
@martinhsv
Copy link
Contributor

Hello @FireBurn ,

Yes, those are known. They show up when running with the --enable-valgrind option.

@FireBurn
Copy link
Author

So these aren't issues?

@martinhsv
Copy link
Contributor

Closing as duplicate.

@FireBurn
Copy link
Author

I don't think you answered my question, and which issue is this a duplicate off?

@martinhsv
Copy link
Contributor

It is an issue. That is why it is explicitly called out in the code at ...

https://github.com/SpiderLabs/ModSecurity/blob/5dfc0a256a27ea6245a972a2a6ab9c1a4edd2599/src/parser/driver.h#L58

With the creation of your issue, it was the 6th one simultaneously open that fundamentally about the same thing. The oldest was #2502 .

I have since closed all of them and replaced them with a single new item (#2848 )

@FireBurn
Copy link
Author

Thanks :D

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