Skip to content

Conversation

xqcool
Copy link
Contributor

@xqcool xqcool commented Dec 31, 2019

Problem:Calling back on an empty container causes undefined behavior.
Solution:Check with the function empty()

Problem:Calling back on an empty container causes undefined behavior.
Solution:Check with the function empty()
@bluca
Copy link
Member

bluca commented Dec 31, 2019

Thanks for the PR - please add a commit with a relicense statement https://github.com/zeromq/libzmq/blob/master/RELICENSE/README.md

Adds relicensing grant
@xqcool
Copy link
Contributor Author

xqcool commented Jan 1, 2020

Thanks for the PR - please add a commit with a relicense statement https://github.com/zeromq/libzmq/blob/master/RELICENSE/README.md

OK.

@bluca bluca merged commit 382c6d7 into zeromq:master Jan 1, 2020
@sigiesec
Copy link
Member

sigiesec commented Jan 6, 2020

You are right that calling back on an empty container has undefined behaviour, but this is not a legal use of array::erase anyway. Rather than changing the condition, the if should be removed entirely, or changed into zmq_assert (!_items.empty()); or rather zmq_assert (items.size() > index_);

@xqcool
Copy link
Contributor Author

xqcool commented Jan 7, 2020 via email

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.

3 participants