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

-fsanitize=undefined runtime error: member access within null pointer of type 'struct TxItem' #203

Closed
jvishnefske opened this issue Oct 28, 2022 · 2 comments · Fixed by #204 or #205
Labels

Comments

@jvishnefske
Copy link
Contributor

I compiled canard.c from release tarball 3.0.0, and the public catch2 tests with my meson file. -fsanitize=undefined seems to be triggering while running unit tests.

../subprojects/libcanard-3.0.0/tests/test_public_tx.cpp:101:
PASSED:
REQUIRE( 3 == alloc.getNumAllocatedFragments() )
with expansion:
3 == 3
Screenshot

../subprojects/libcanard-3.0.0/libcanard/canard.c:413:47: runtime error: member access within null pointer of type 'struct TxItem'
../subprojects/libcanard-3.0.0/tests/test_public_tx.cpp:107:
PASSED:
REQUIRE( -3 == que.push(&ins.getInstance(), 1'000'000'000'300ULL, meta, 100, payload.data()) )
with expansion:
-3 == -3

#meson setup --warnlevel 2 --werror -Db_lto=false -Db_coverage=true -Db_sanitize="undefined" build-dir
project('canard', ['c','cpp'],
  version : '3.0.0',
  default_options : ['cpp_std=c++17'])

canard_incdir = include_directories('libcanard', '.', is_system : false)
canard_libsources = files('libcanard/canard.c')
canard_lib = library('canard', canard_libsources)
canard_dep = declare_dependency(
    link_with: canard_lib,
    include_directories : canard_incdir)

test_sources_public = [
'tests/test_public_tx.cpp',
'tests/catch/main.cpp',
'tests/test_public_roundtrip.cpp',
'tests/test_self.cpp',
'tests/test_public_filters.cpp',
'tests/test_public_rx.cpp',
]
# build subset which tests public interface.
canard_interface_tests = executable(
        'canard_test',
        test_sources_public,
        dependencies:[canard_dep, dependency('threads')],
        include_directories:['tests/catch','tests'],
        install: false,

    )
test('canard_tests', canard_interface_tests)
pavel-kirienko added a commit that referenced this issue Oct 29, 2022
@pavel-kirienko pavel-kirienko mentioned this issue Oct 29, 2022
@pavel-kirienko
Copy link
Member

Thanks! The first one is legit -- although it has no practical significance, it is technically a UB, so I opened #204 to fix it. The other two are unhelpful.

Could you please help us set up the sanitizer in the CI?

pavel-kirienko added a commit that referenced this issue Oct 30, 2022
* Fix #203

* Update the changelog
@jvishnefske
Copy link
Contributor Author

Started #205 in attempt to add sanitizer to cmake build. It may take some experimenting to get right on CI.

@pavel-kirienko pavel-kirienko linked a pull request Nov 2, 2022 that will close this issue
pavel-kirienko pushed a commit that referenced this issue Nov 3, 2022
Related to #203 

Co-authored-by: John Vishnefske <john.vishnefske@viavisolutions.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants