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

iox::rp::RelativePointer violates type safety #1121

Closed
elfenpiff opened this issue Feb 17, 2022 · 2 comments · Fixed by #1168
Closed

iox::rp::RelativePointer violates type safety #1121

elfenpiff opened this issue Feb 17, 2022 · 2 comments · Fixed by #1168
Assignees
Labels
bug Something isn't working
Milestone

Comments

@elfenpiff
Copy link
Contributor

Required information

It is possible to assign any arbitrary pointer to the RelativePointer, see the following code:

float f;
iox::rp::RelativePointer<int> ptr{&f}; // is accepted but should result in a compile time error
int* fuu = ptr; // this causes now problems since we have a pointer to the wrong type

// as comparision
int * fuu = &f; // this leads to a compile time error.

The AtomicRelocatablePointer is not affected and works as expected.

@elfenpiff elfenpiff added the bug Something isn't working label Feb 17, 2022
@elfenpiff
Copy link
Contributor Author

FYI @MatthiasKillat . I think this may be fixed quickly - do you have time to fix this before 2.0 ?

@elfenpiff elfenpiff added this to the Medium prio milestone Feb 17, 2022
@MatthiasKillat
Copy link
Contributor

MatthiasKillat commented Feb 17, 2022

@elfenpiff I think I have the time. But at some point I wanted to also refactor the whole design, e.g. without inheritance which was a questionable decision and an optimized lookup/repository (lookup needs to be fast, as it happens anytime we dereference). The refactoring would clean up some code similar to the refactoring of relocatable_ptr (which already happened).

Before 2.0: bugfix yes, refactoring no. Will have a look tomorrow.

@MatthiasKillat MatthiasKillat changed the title iox::rp::RelativePointer destroys type safety iox::rp::RelativePointer violates type safety Feb 25, 2022
MatthiasKillat added a commit to ApexAI/iceoryx that referenced this issue Feb 25, 2022
Signed-off-by: Matthias Killat <matthias.killat@apex.ai>
MatthiasKillat added a commit to ApexAI/iceoryx that referenced this issue Feb 25, 2022
Signed-off-by: Matthias Killat <matthias.killat@apex.ai>
MatthiasKillat added a commit to ApexAI/iceoryx that referenced this issue Feb 25, 2022
Signed-off-by: Matthias Killat <matthias.killat@apex.ai>
MatthiasKillat added a commit to ApexAI/iceoryx that referenced this issue Feb 25, 2022
Signed-off-by: Matthias Killat <matthias.killat@apex.ai>
MatthiasKillat added a commit to ApexAI/iceoryx that referenced this issue Feb 25, 2022
Signed-off-by: Matthias Killat <matthias.killat@apex.ai>
MatthiasKillat added a commit to ApexAI/iceoryx that referenced this issue Feb 25, 2022
Signed-off-by: Matthias Killat <matthias.killat@apex.ai>
MatthiasKillat added a commit to ApexAI/iceoryx that referenced this issue Feb 28, 2022
Signed-off-by: Matthias Killat <matthias.killat@apex.ai>
MatthiasKillat added a commit to ApexAI/iceoryx that referenced this issue Feb 28, 2022
Signed-off-by: Matthias Killat <matthias.killat@apex.ai>
MatthiasKillat added a commit to ApexAI/iceoryx that referenced this issue Feb 28, 2022
Signed-off-by: Matthias Killat <matthias.killat@apex.ai>
MatthiasKillat added a commit to ApexAI/iceoryx that referenced this issue Feb 28, 2022
Signed-off-by: Matthias Killat <matthias.killat@apex.ai>
MatthiasKillat added a commit to ApexAI/iceoryx that referenced this issue Feb 28, 2022
Signed-off-by: Matthias Killat <matthias.killat@apex.ai>
MatthiasKillat added a commit to ApexAI/iceoryx that referenced this issue Feb 28, 2022
Signed-off-by: Matthias Killat <matthias.killat@apex.ai>
MatthiasKillat added a commit that referenced this issue Feb 28, 2022
…e-ptr-conversion

Iox #1121 only type safe relative ptr conversion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants