eclipse-iceoryx / eclipse-iceoryx/iceoryx
'variant' has undefined behavior for assignment operator of underlying value
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 492
- Avg merge
- 18h 57m
- Merged PRs (30d)
- 1
Description
## Required information
**Operating system:**
any
**Compiler version:**
any
**Eclipse iceoryx version:**
all
**Observed result or behaviour:**
This leads to undefined behavior since the memory is not initialized with a `Foo` but the implementation calls the assignment operator of `Foo` with the uninitialized memory as left hand side.
```cpp
variant f;
f = Foo{};
```
**Expected result or behaviour:**
No undefined behavior.
**Conditions where it occurred / Performed steps:**
code review
Contributor guide
Research direction
Start by locating the C++ variant implementation and its assignment-related tests. Reproduce the reported variant assignment example, then inspect whether the underlying value is initialized before assignment. Done means the example no longer has undefined behavior and the relevant tests cover it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100