Skip to content

Add sanitizer option and fix ASan-reported use-after-free#125

Merged
m7913d merged 8 commits intoxlnt-community:masterfrom
Fabio3rs:sanitizers
Dec 16, 2025
Merged

Add sanitizer option and fix ASan-reported use-after-free#125
m7913d merged 8 commits intoxlnt-community:masterfrom
Fabio3rs:sanitizers

Conversation

@Fabio3rs
Copy link
Copy Markdown
Contributor

@Fabio3rs Fabio3rs commented Dec 6, 2025

Enable optional Address/Undefined/Leak sanitizer builds via XLNT_SANITIZE, fix a heap-use-after-free in stylesheet destruction, improve xlsx_producer cleanup, and add a UBSan suppression for a benign Expat null-pointer arithmetic warning (details in the ASan/UBSan log below).

ASAN_OPTIONS=halt_on_error=0 ./xlnt.test 2>&1 | tee error.log
............................................./mnt/projects/Projects/xlnt/third-party/libstudxml/libstudxml/details/expat/xmlparse.c:6150:23: runtime error: applying zero offset to null pointer
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /mnt/projects/Projects/xlnt/third-party/libstudxml/libstudxml/details/expat/xmlparse.c:6150:23 
....=================================================================
==14091==ERROR: AddressSanitizer: heap-use-after-free on address 0x519000030178 at pc 0x5933b212e2c9 bp 0x7ffe423c2580 sp 0x7ffe423c2578
READ of size 1 at 0x519000030178 thread T0
    #0 0x5933b212e2c8 in xlnt::optional<xlnt::diagonal_direction>::clear() /mnt/projects/Projects/xlnt/source/../include/xlnt/utils/optional.hpp:249:13
    #1 0x5933b212e1e4 in xlnt::optional<xlnt::diagonal_direction>::~optional() /mnt/projects/Projects/xlnt/source/../include/xlnt/utils/optional.hpp:178:9
    #2 0x5933b212e12b in xlnt::border::~border() /mnt/projects/Projects/xlnt/source/../include/xlnt/styles/border.hpp:91:16
    #3 0x76b36323198e in void std::__new_allocator<xlnt::border>::destroy<xlnt::border>(xlnt::border*) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/new_allocator.h:198:10
    #4 0x76b36323198e in void std::allocator_traits<std::allocator<xlnt::border>>::destroy<xlnt::border>(std::allocator<xlnt::border>&, xlnt::border*) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/alloc_traits.h:554:8
    #5 0x76b36323198e in std::vector<xlnt::border, std::allocator<xlnt::border>>::_M_erase(__gnu_cxx::__normal_iterator<xlnt::border*, std::vector<xlnt::border, std::allocator<xlnt::border>>>) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/vector.tcc:187:7
    #6 0x76b363231458 in std::vector<xlnt::border, std::allocator<xlnt::border>>::erase(__gnu_cxx::__normal_iterator<xlnt::border const*, std::vector<xlnt::border, std::allocator<xlnt::border>>>) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_vector.h:1537:16
    #7 0x76b363225b86 in std::unordered_map<unsigned long, unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<std::pair<unsigned long const, unsigned long>>> xlnt::detail::stylesheet::garbage_collect<xlnt::border>(std::unordered_map<unsigned long, unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<std::pair<unsigned long const, unsigned long>>> const&, std::vector<xlnt::border, std::allocator<xlnt::border>>&) /mnt/projects/Projects/xlnt/source/../source/detail/implementations/stylesheet.hpp:213:27
    #8 0x76b363203554 in xlnt::detail::stylesheet::garbage_collect() /mnt/projects/Projects/xlnt/source/../source/detail/implementations/stylesheet.hpp:324:30
    #9 0x76b3631fc9a2 in xlnt::detail::format_impl_ptr::decrement() /mnt/projects/Projects/xlnt/source/styles/format.cpp:242:30
    #10 0x5933b21298d4 in xlnt::detail::format_impl_ptr::~format_impl_ptr() /mnt/projects/Projects/xlnt/source/../include/xlnt/internal/format_impl_ptr.hpp:38:23
    #11 0x76b3632f1d2b in xlnt::detail::stylesheet::~stylesheet() /mnt/projects/Projects/xlnt/source/../source/detail/implementations/stylesheet.hpp:47:8
    #12 0x76b3632f9e50 in xlnt::optional<xlnt::detail::stylesheet>::clear() /mnt/projects/Projects/xlnt/source/../include/xlnt/utils/optional.hpp:251:48
    #13 0x76b36336fa34 in xlnt::optional<xlnt::detail::stylesheet>::~optional() /mnt/projects/Projects/xlnt/source/../include/xlnt/utils/optional.hpp:178:9
    #14 0x76b3632f9d48 in xlnt::detail::workbook_impl::~workbook_impl() /mnt/projects/Projects/xlnt/source/../source/detail/implementations/workbook_impl.hpp:49:8
    #15 0x76b36339f70c in void std::_Destroy<xlnt::detail::workbook_impl>(xlnt::detail::workbook_impl*) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_construct.h:151:19
    #16 0x76b36339ee70 in void std::allocator_traits<std::allocator<void>>::destroy<xlnt::detail::workbook_impl>(std::allocator<void>&, xlnt::detail::workbook_impl*) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/alloc_traits.h:671:4
    #17 0x76b36339ee70 in std::_Sp_counted_ptr_inplace<xlnt::detail::workbook_impl, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_M_dispose() /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/shared_ptr_base.h:616:2
    #18 0x5933b2105c0f in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release_last_use() /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/shared_ptr_base.h:175:2
    #19 0x5933b2105b1c in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release_last_use_cold() /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/shared_ptr_base.h:199:9
    #20 0x5933b2105a47 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/shared_ptr_base.h:353:8
    #21 0x5933b21052ef in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/shared_ptr_base.h:1069:11
    #22 0x5933b21051c8 in std::__shared_ptr<xlnt::detail::workbook_impl, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/shared_ptr_base.h:1525:31
    #23 0x5933b2105174 in std::shared_ptr<xlnt::detail::workbook_impl>::~shared_ptr() /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/shared_ptr.h:175:11
    #24 0x5933b2105124 in xlnt::workbook::~workbook() /mnt/projects/Projects/xlnt/source/../include/xlnt/workbook/workbook.hpp:198:25
    #25 0x5933b2195e67 in conditional_format_test_suite::test_all() /mnt/projects/Projects/xlnt/tests/styles/conditional_format_test_suite.cpp:63:5
    #26 0x5933b2192bc5 in conditional_format_test_suite::conditional_format_test_suite()::'lambda'()::operator()() const /mnt/projects/Projects/xlnt/tests/styles/conditional_format_test_suite.cpp:34:9
    #27 0x5933b2192b4c in void std::__invoke_impl<void, conditional_format_test_suite::conditional_format_test_suite()::'lambda'()&>(std::__invoke_other, conditional_format_test_suite::conditional_format_test_suite()::'lambda'()&) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/invoke.h:61:14
    #28 0x5933b2192a6c in std::enable_if<is_void<void>::value, void>::type std::__invoke_r<void, conditional_format_test_suite::conditional_format_test_suite()::'lambda'()&>(conditional_format_test_suite::conditional_format_test_suite()::'lambda'()&) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/invoke.h:150:7
    #29 0x5933b2192744 in std::_Function_handler<void (), conditional_format_test_suite::conditional_format_test_suite()::'lambda'()>::_M_invoke(std::_Any_data const&) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/std_function.h:290:9
    #30 0x5933b2604a9d in std::function<void ()>::operator()() const /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/std_function.h:591:9
    #31 0x5933b260391d in test_suite::go() /mnt/projects/Projects/xlnt/tests/helpers/test_suite.cpp:23:13
    #32 0x5933b20ead2b in main /mnt/projects/Projects/xlnt/tests/runner.cpp:44:34
    #33 0x76b36202a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #34 0x76b36202a28a in __libc_start_main csu/../csu/libc-start.c:360:3
    #35 0x5933b1e7e114 in _start (/mnt/projects/Projects/xlnt/build/tests/xlnt.test+0x366114) (BuildId: 2a1bcc8499afb87a762aed4e341330fc6115adea)

0x519000030178 is located 1016 bytes inside of 1024-byte region [0x51900002fd80,0x519000030180)
freed by thread T0 here:
    #0 0x5933b1f60246 in operator delete(void*, unsigned long) (/mnt/projects/Projects/xlnt/build/tests/xlnt.test+0x448246) (BuildId: 2a1bcc8499afb87a762aed4e341330fc6115adea)
    #1 0x5933b24a8942 in std::__new_allocator<xlnt::border>::deallocate(xlnt::border*, unsigned long) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/new_allocator.h:172:2
    #2 0x5933b24a8879 in std::allocator_traits<std::allocator<xlnt::border>>::deallocate(std::allocator<xlnt::border>&, xlnt::border*, unsigned long) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/alloc_traits.h:513:13
    #3 0x5933b24a8879 in std::_Vector_base<xlnt::border, std::allocator<xlnt::border>>::_M_deallocate(xlnt::border*, unsigned long) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_vector.h:389:4
    #4 0x5933b24a8660 in std::_Vector_base<xlnt::border, std::allocator<xlnt::border>>::~_Vector_base() /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_vector.h:368:2
    #5 0x5933b24a69c4 in std::vector<xlnt::border, std::allocator<xlnt::border>>::~vector() /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_vector.h:738:7
    #6 0x76b3632f1d0b in xlnt::detail::stylesheet::~stylesheet() /mnt/projects/Projects/xlnt/source/../source/detail/implementations/stylesheet.hpp:47:8
    #7 0x76b3632f9e50 in xlnt::optional<xlnt::detail::stylesheet>::clear() /mnt/projects/Projects/xlnt/source/../include/xlnt/utils/optional.hpp:251:48
    #8 0x76b36336fa34 in xlnt::optional<xlnt::detail::stylesheet>::~optional() /mnt/projects/Projects/xlnt/source/../include/xlnt/utils/optional.hpp:178:9
    #9 0x76b3632f9d48 in xlnt::detail::workbook_impl::~workbook_impl() /mnt/projects/Projects/xlnt/source/../source/detail/implementations/workbook_impl.hpp:49:8
    #10 0x76b36339f70c in void std::_Destroy<xlnt::detail::workbook_impl>(xlnt::detail::workbook_impl*) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_construct.h:151:19
    #11 0x76b36339ee70 in void std::allocator_traits<std::allocator<void>>::destroy<xlnt::detail::workbook_impl>(std::allocator<void>&, xlnt::detail::workbook_impl*) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/alloc_traits.h:671:4
    #12 0x76b36339ee70 in std::_Sp_counted_ptr_inplace<xlnt::detail::workbook_impl, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_M_dispose() /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/shared_ptr_base.h:616:2
    #13 0x5933b2105c0f in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release_last_use() /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/shared_ptr_base.h:175:2
    #14 0x5933b2105b1c in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release_last_use_cold() /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/shared_ptr_base.h:199:9
    #15 0x5933b2105a47 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/shared_ptr_base.h:353:8
    #16 0x5933b21052ef in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/shared_ptr_base.h:1069:11
    #17 0x5933b21051c8 in std::__shared_ptr<xlnt::detail::workbook_impl, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/shared_ptr_base.h:1525:31
    #18 0x5933b2105174 in std::shared_ptr<xlnt::detail::workbook_impl>::~shared_ptr() /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/shared_ptr.h:175:11
    #19 0x5933b2105124 in xlnt::workbook::~workbook() /mnt/projects/Projects/xlnt/source/../include/xlnt/workbook/workbook.hpp:198:25
    #20 0x5933b2195e67 in conditional_format_test_suite::test_all() /mnt/projects/Projects/xlnt/tests/styles/conditional_format_test_suite.cpp:63:5
    #21 0x5933b2192bc5 in conditional_format_test_suite::conditional_format_test_suite()::'lambda'()::operator()() const /mnt/projects/Projects/xlnt/tests/styles/conditional_format_test_suite.cpp:34:9
    #22 0x5933b2192b4c in void std::__invoke_impl<void, conditional_format_test_suite::conditional_format_test_suite()::'lambda'()&>(std::__invoke_other, conditional_format_test_suite::conditional_format_test_suite()::'lambda'()&) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/invoke.h:61:14
    #23 0x5933b2192a6c in std::enable_if<is_void<void>::value, void>::type std::__invoke_r<void, conditional_format_test_suite::conditional_format_test_suite()::'lambda'()&>(conditional_format_test_suite::conditional_format_test_suite()::'lambda'()&) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/invoke.h:150:7
    #24 0x5933b2192744 in std::_Function_handler<void (), conditional_format_test_suite::conditional_format_test_suite()::'lambda'()>::_M_invoke(std::_Any_data const&) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/std_function.h:290:9
    #25 0x5933b2604a9d in std::function<void ()>::operator()() const /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/std_function.h:591:9
    #26 0x5933b260391d in test_suite::go() /mnt/projects/Projects/xlnt/tests/helpers/test_suite.cpp:23:13
    #27 0x5933b20ead2b in main /mnt/projects/Projects/xlnt/tests/runner.cpp:44:34
    #28 0x76b36202a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #29 0x76b36202a28a in __libc_start_main csu/../csu/libc-start.c:360:3
    #30 0x5933b1e7e114 in _start (/mnt/projects/Projects/xlnt/build/tests/xlnt.test+0x366114) (BuildId: 2a1bcc8499afb87a762aed4e341330fc6115adea)

previously allocated by thread T0 here:
    #0 0x5933b1f5f5c1 in operator new(unsigned long) (/mnt/projects/Projects/xlnt/build/tests/xlnt.test+0x4475c1) (BuildId: 2a1bcc8499afb87a762aed4e341330fc6115adea)
    #1 0x76b3631dab17 in std::__new_allocator<xlnt::border>::allocate(unsigned long, void const*) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/new_allocator.h:151:27
    #2 0x76b3631d9efd in std::allocator_traits<std::allocator<xlnt::border>>::allocate(std::allocator<xlnt::border>&, unsigned long) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/alloc_traits.h:478:20
    #3 0x76b3631d9efd in std::_Vector_base<xlnt::border, std::allocator<xlnt::border>>::_M_allocate(unsigned long) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_vector.h:380:20
    #4 0x76b3631d5565 in void std::vector<xlnt::border, std::allocator<xlnt::border>>::_M_realloc_insert<xlnt::border const&>(__gnu_cxx::__normal_iterator<xlnt::border*, std::vector<xlnt::border, std::allocator<xlnt::border>>>, xlnt::border const&) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/vector.tcc:467:33
    #5 0x76b3631d3779 in __gnu_cxx::__normal_iterator<xlnt::border*, std::vector<xlnt::border, std::allocator<xlnt::border>>> std::vector<xlnt::border, std::allocator<xlnt::border>>::_M_emplace_aux<xlnt::border const&>(__gnu_cxx::__normal_iterator<xlnt::border const*, std::vector<xlnt::border, std::allocator<xlnt::border>>>, xlnt::border const&) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/vector.tcc:411:4
    #6 0x76b3631d1f06 in __gnu_cxx::__normal_iterator<xlnt::border*, std::vector<xlnt::border, std::allocator<xlnt::border>>> std::vector<xlnt::border, std::allocator<xlnt::border>>::emplace<xlnt::border const&>(__gnu_cxx::__normal_iterator<xlnt::border const*, std::vector<xlnt::border, std::allocator<xlnt::border>>>, xlnt::border const&) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_vector.h:1349:11
    #7 0x76b3631cd481 in unsigned long xlnt::detail::stylesheet::find_or_add<xlnt::border, std::vector<xlnt::border, std::allocator<xlnt::border>>>(std::vector<xlnt::border, std::allocator<xlnt::border>>&, xlnt::border const&) /mnt/projects/Projects/xlnt/source/../source/detail/implementations/stylesheet.hpp:193:26
    #8 0x76b3631cb980 in xlnt::conditional_format::border(xlnt::border const&) /mnt/projects/Projects/xlnt/source/styles/conditional_format.cpp:98:33
    #9 0x5933b219401e in conditional_format_test_suite::test_all() /mnt/projects/Projects/xlnt/tests/styles/conditional_format_test_suite.cpp:47:16
    #10 0x5933b2192bc5 in conditional_format_test_suite::conditional_format_test_suite()::'lambda'()::operator()() const /mnt/projects/Projects/xlnt/tests/styles/conditional_format_test_suite.cpp:34:9
    #11 0x5933b2192b4c in void std::__invoke_impl<void, conditional_format_test_suite::conditional_format_test_suite()::'lambda'()&>(std::__invoke_other, conditional_format_test_suite::conditional_format_test_suite()::'lambda'()&) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/invoke.h:61:14
    #12 0x5933b2192a6c in std::enable_if<is_void<void>::value, void>::type std::__invoke_r<void, conditional_format_test_suite::conditional_format_test_suite()::'lambda'()&>(conditional_format_test_suite::conditional_format_test_suite()::'lambda'()&) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/invoke.h:150:7
    #13 0x5933b2192744 in std::_Function_handler<void (), conditional_format_test_suite::conditional_format_test_suite()::'lambda'()>::_M_invoke(std::_Any_data const&) /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/std_function.h:290:9
    #14 0x5933b2604a9d in std::function<void ()>::operator()() const /usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/std_function.h:591:9
    #15 0x5933b260391d in test_suite::go() /mnt/projects/Projects/xlnt/tests/helpers/test_suite.cpp:23:13
    #16 0x5933b20ead2b in main /mnt/projects/Projects/xlnt/tests/runner.cpp:44:34
    #17 0x76b36202a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #18 0x76b36202a28a in __libc_start_main csu/../csu/libc-start.c:360:3
    #19 0x5933b1e7e114 in _start (/mnt/projects/Projects/xlnt/build/tests/xlnt.test+0x366114) (BuildId: 2a1bcc8499afb87a762aed4e341330fc6115adea)

SUMMARY: AddressSanitizer: heap-use-after-free /mnt/projects/Projects/xlnt/source/../include/xlnt/utils/optional.hpp:249:13 in xlnt::optional<xlnt::diagonal_direction>::clear()
Shadow bytes around the buggy address:
  0x51900002fe80: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x51900002ff00: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x51900002ff80: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x519000030000: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x519000030080: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x519000030100: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd[fd]
  0x519000030180: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x519000030200: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x519000030280: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x519000030300: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x519000030380: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==14091==ABORTING

…lnt library

fix(stylesheet.hpp): add default constructors and destructor to stylesheet class
fix(xlsx_producer.cpp): properly delete current_cell_ and current_worksheet_ in destructor
chore: add ubsan suppression file for xlnt library
Comment thread ubsan.supp
@m7913d
Copy link
Copy Markdown
Member

m7913d commented Dec 7, 2025

Do you think that we should also run asan as part of our CI?

@m7913d
Copy link
Copy Markdown
Member

m7913d commented Dec 7, 2025

Coverage report is available at: full | review summary

@Fabio3rs
Copy link
Copy Markdown
Contributor Author

Fabio3rs commented Dec 7, 2025

@m7913d

Do you think that we should also run asan as part of our CI?

Yes, I think so. Running the existing unit and feature tests under ASan in CI would help catch memory and undefined-behavior issues earlier. I’ve also had good experience with other projects running ASan on CI + unit and feature tests.

@m7913d
Copy link
Copy Markdown
Member

m7913d commented Dec 7, 2025

Yes, I think so. Running the existing unit and feature tests under ASan in CI would help catch memory and undefined-behavior issues earlier. I’ve also had good experience with other projects running ASan on CI + unit and feature tests.

Feel free to add it to our CI (see .circleci/continue_config.yml) or I can add it after this PR is merged.

@Fabio3rs Fabio3rs marked this pull request as ready for review December 7, 2025 02:25
@Fabio3rs
Copy link
Copy Markdown
Contributor Author

Fabio3rs commented Dec 7, 2025

Yes, I think so. Running the existing unit and feature tests under ASan in CI would help catch memory and undefined-behavior issues earlier. I’ve also had good experience with other projects running ASan on CI + unit and feature tests.

Feel free to add it to our CI (see .circleci/continue_config.yml) or I can add it after this PR is merged.

Thanks! I don’t have much experience with CircleCI config yet, but I can take a look the config file tomorrow and try to add an ASan job, if you don’t mind waiting a bit.

…d behavior sanitizers

fix(CMakeLists.txt): update MSVC sanitizer options for VS 2019 16.9+
fix(ubsan.supp): correct suppression file usage in comments
@Fabio3rs
Copy link
Copy Markdown
Contributor Author

Fabio3rs commented Dec 8, 2025

Adjusts on CI:
Added sanitize parameter as default OFF to preserve the current jobs configs
Added exclusive jobs for sanitizers

............................................................................................................................................................................................................................/root/project/source/../include/xlnt/cell/rich_text_run.hpp:38:17: runtime error: load of value 15, which is not a valid value for type 'bool'
.......................................................................................................................................................................................................................

Run: 435
Passed: 435
Failed: 0

Hm, this doesn't happened here, but happened on the CI.

…on path to use $PWD for consistency and correctness across different working directories
Comment thread .circleci/continue_config_in.yml
Comment thread .circleci/continue_config_in.yml
@Fabio3rs
Copy link
Copy Markdown
Contributor Author

Fabio3rs commented Dec 8, 2025

I am not sure what is going on the MSVC workflow, I am analyzing the logs now.

@Fabio3rs
Copy link
Copy Markdown
Contributor Author

Fabio3rs commented Dec 9, 2025

@m7913d can you Rerun the CircleCI with SSH and check if the util "ldd" is available on the CI VM and what are the libs the xlnt.test.exe is using? Maybe trying to run with cmd.exe to see the other error message. I think the ASan Libraries aren't in the Windows CI VM %PATH%.
If this is the case and we can't easily enable/add the ASan libs to Windows' PATH, I would remove the Windows Job with sanitizers.
Thanks.

@m7913d
Copy link
Copy Markdown
Member

m7913d commented Dec 9, 2025

@m7913d can you Rerun the CircleCI with SSH and check if the util "ldd" is available on the CI VM and what are the libs the xlnt.test.exe is using? Maybe trying to run with cmd.exe to see the other error message. I think the ASan Libraries aren't in the Windows CI VM %PATH%. If this is the case and we can't easily enable/add the ASan libs to Windows' PATH, I would remove the Windows Job with sanitizers. Thanks.

Ok, I will have a look at it.

@m7913d
Copy link
Copy Markdown
Member

m7913d commented Dec 14, 2025

can you Rerun the CircleCI with SSH and check if the util "ldd" is available on the CI VM and what are the libs the xlnt.test.exe is using? Maybe trying to run with cmd.exe to see the other error message. I think the ASan Libraries aren't in the Windows CI VM %PATH%.

@Fabio3rs You are right, the asan libraries are not in the %PATH% by default. Adding the following should work (just before executing xlnt.test.exe):

set PATH=%PATH%;c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx86\x64

@Fabio3rs
Copy link
Copy Markdown
Contributor Author

can you Rerun the CircleCI with SSH and check if the util "ldd" is available on the CI VM and what are the libs the xlnt.test.exe is using? Maybe trying to run with cmd.exe to see the other error message. I think the ASan Libraries aren't in the Windows CI VM %PATH%.

@Fabio3rs You are right, the asan libraries are not in the %PATH% by default. Adding the following should work (just before executing xlnt.test.exe):

set PATH=%PATH%;c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx86\x64

@m7913d thanks, I am going to add this line

@Fabio3rs
Copy link
Copy Markdown
Contributor Author

@m7913d the windows CI is using git bash, I add some code to find automatically the MSVC libraries that should continue working after the MSVC update.

Copy link
Copy Markdown
Member

@m7913d m7913d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR!

@m7913d
Copy link
Copy Markdown
Member

m7913d commented Dec 15, 2025

Coverage report is available at: full | review summary

@Fabio3rs
Copy link
Copy Markdown
Contributor Author

Thanks for your PR!

I am glad to help!

@m7913d m7913d merged commit 86a807a into xlnt-community:master Dec 16, 2025
37 checks passed
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

Successfully merging this pull request may close these issues.

2 participants