Skip to content

Potential null pointer dereference #2450

Open
@Wiktor-99

Description

@Wiktor-99

Required information

Operating system:
Ubuntu 20.04/22.04/24.04 LTS

Compiler version:
GCC 14.2.0

Eclipse iceoryx version:
v2.0.6

Observed result or behaviour:
While compiling with -O2 flag following warnings are seen:

In constructor ‘iox::cxx::error<T>::error(Targs&& ...) [with Targs = {iox::popo::AllocationError&}; T = iox::popo::AllocationError]’,
63.43     inlined from ‘iox::cxx::expected<void*, iox::popo::AllocationError> iox::popo::UntypedPublisherImpl<BasePublisherType>::loan(uint32_t, uint32_t, uint32_t, uint32_t) [with BasePublisherType = iox::popo::BasePublisher<>]’ at /usr/local/include/iceoryx/v2.0.6/iceoryx_posh/internal/popo/untyped_publisher_impl.inl:51:21,
63.43 /usr/local/include/iceoryx/v2.0.6/iceoryx_hoofs/internal/cxx/expected.inl:72:7: error: potential null pointer dereference [-Werror=null-dereference]
63.43    72 |     : value(std::forward<Targs>(args)...)
63.43       |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63.43 In file included from /usr/local/include/iceoryx/v2.0.6/iceoryx_posh/internal/popo/untyped_publisher_impl.hpp:79:
63.43 In member function ‘iox::cxx::expected<void*, iox::popo::AllocationError> iox::popo::UntypedPublisherImpl<BasePublisherType>::loan(uint32_t, uint32_t, uint32_t, uint32_t) [with BasePublisherType = iox::popo::BasePublisher<>]’,
63.43 /usr/local/include/iceoryx/v2.0.6/iceoryx_posh/internal/popo/untyped_publisher_impl.inl:55:63: error: potential null pointer dereference [-Werror=null-dereference]
63.43    55 |         return cxx::success<void*>(result.value()->userPayload());

Expected result or behaviour:
What do you expect to happen?
No warnings.

Conditions where it occurred / Performed steps:
Compile with gcc-14.2.0 and -O2 flag

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs infoA bug report is waiting for more information

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions