libsass icon indicating copy to clipboard operation
libsass copied to clipboard

memory leaks in src/parser.cpp:765

Open puppet-meteor opened this issue 4 years ago • 1 comments

Version: sassc-3.6.1-8-g3e73 libsass-3.6.3-57-g9515

OS: Ubuntu 16.04 LTS

POC: https://github.com/puppet-meteor/NLP_POC/blob/master/sassc/POC_1_002081

cmd: ./sassc POC

ASAN log:

================================================================= ==40261==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 208 byte(s) in 1 object(s) allocated from: #0 0x7ffff6f03532 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99532) #1 0x57513d in Sass::Parser::parse_pseudo_selector() src/parser.cpp:765

Indirect leak of 1013 byte(s) in 2 object(s) allocated from: #0 0x7ffff6f02602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602) #1 0x4213e8 in sass_alloc_memory src/sass.cpp:39

Indirect leak of 480 byte(s) in 4 object(s) allocated from: #0 0x7ffff6f03532 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99532) #1 0x570585 in Sass::Parser::parse_css_variable_value() src/parser.cpp:1602 #2 0x575070 in Sass::Parser::parse_pseudo_selector() src/parser.cpp:764

Indirect leak of 240 byte(s) in 2 object(s) allocated from: #0 0x7ffff6f03532 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99532) #1 0x572120 in Sass::Parser::parse_css_variable_value() src/parser.cpp:1633 #2 0x575070 in Sass::Parser::parse_pseudo_selector() src/parser.cpp:764

Indirect leak of 240 byte(s) in 2 object(s) allocated from: #0 0x7ffff6f03532 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99532) #1 0x5719dc in Sass::Parser::parse_css_variable_value() src/parser.cpp:1622 #2 0x575070 in Sass::Parser::parse_pseudo_selector() src/parser.cpp:764

Indirect leak of 128 byte(s) in 1 object(s) allocated from: #0 0x7ffff6f03532 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99532) #1 0x56feac in Sass::Parser::parse_css_variable_value() src/parser.cpp:1594 #2 0x575070 in Sass::Parser::parse_pseudo_selector() src/parser.cpp:764

Indirect leak of 64 byte(s) in 1 object(s) allocated from: #0 0x7ffff6f03532 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99532) #1 0x5a0071 in __gnu_cxx::new_allocator<Sass::SharedImplSass::Media_Query_Expression >::allocate(unsigned long, void const*) /usr/include/c++/5/ext/new_allocator.h:104 #2 0x5a0071 in std::allocator_traits<std::allocator<Sass::SharedImplSass::Media_Query_Expression > >::allocate(std::allocator<Sass::SharedImplSass::Media_Query_Expression >&, unsigned long) /usr/include/c++/5/bits/alloc_traits.h:491 #3 0x5a0071 in std::_Vector_base<Sass::SharedImplSass::Media_Query_Expression, std::allocator<Sass::SharedImplSass::Media_Query_Expression > >::_M_allocate(unsigned long) /usr/include/c++/5/bits/stl_vector.h:170 #4 0x5a0071 in void std::vector<Sass::SharedImplSass::PreValue, std::allocator<Sass::SharedImplSass::PreValue > >::_M_insert_aux<Sass::SharedImplSass::PreValue const&>(__gnu_cxx::__normal_iterator<Sass::SharedImplSass::PreValue*, std::vector<Sass::SharedImplSass::PreValue, std::allocator<Sass::SharedImplSass::PreValue > > >, Sass::SharedImplSass::PreValue const&) /usr/include/c++/5/bits/vector.tcc:353

Indirect leak of 56 byte(s) in 1 object(s) allocated from: #0 0x7ffff6f03532 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99532) #1 0x43f2c6 in Sass::Context::register_resource(Sass::Include const&, Sass::Resource const&) src/context.cpp:277

Indirect leak of 31 byte(s) in 1 object(s) allocated from: #0 0x7ffff6f03532 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99532) #1 0x7ffff68fe498 in std::__cxx11::basic_string<char, std::char_traits, std::allocator >::_M_mutate(unsigned long, unsigned long, char const*, unsigned long) (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0x11f498)

SUMMARY: AddressSanitizer: 2460 byte(s) leaked in 15 allocation(s).

puppet-meteor avatar May 26 '20 09:05 puppet-meteor

get a lot same warning from linux:

Indirect leak of 16 byte(s) in 1 object(s) allocated from

 #2 0x5b85b8 in std::__1::__libcpp_allocate(unsigned long, unsigned long) /usr/lib/llvm-12/bin/../include/c++/v1/new:261:10
    #3 0x5def71 in std::__1::allocator<Sass::SharedImpl<Sass::SelectorComponent> >::allocate(unsigned long) /usr/lib/llvm-12/bin/../include/c++/v1/memory:865:38
    #4 0x5dee3c in std::__1::allocator_traits<std::__1::allocator<Sass::SharedImpl<Sass::SelectorComponent> > >::allocate(std::__1::allocator<Sass::SharedImpl<Sass::SelectorComponent> >&, unsigned long) /usr/lib/llvm-12/bin/../include/c++/v1/__memory/allocator_traits.h:260:20
    #5 0x5de335 in std::__1::__split_buffer<Sass::SharedImpl<Sass::SelectorComponent>, std::__1::allocator<Sass::SharedImpl<Sass::SelectorComponent> >&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<Sass::SharedImpl<Sass::SelectorComponent> >&) /usr/lib/llvm-12/bin/../include/c++/v1/__split_buffer:314:29
    #6 0x5dddbc in std::__1::vector<Sass::SharedImpl<Sass::SelectorComponent>, std::__1::allocator<Sass::SharedImpl<Sass::SelectorComponent> > >::insert(std::__1::__wrap_iter<Sass::SharedImpl<Sass::SelectorComponent> const*>, Sass::SharedImpl<Sass::SelectorComponent> const&) /usr/lib/llvm-12/bin/../include/c++/v1/vector:1793:53
    #7 0x5cb3a3 in Sass::Vectorized<Sass::SharedImpl<Sass::SelectorComponent> >::append(Sass::SharedImpl<Sass::SelectorComponent>) sass/src/ast.hpp:300:17

calvin2021y avatar Aug 17 '21 12:08 calvin2021y