Adding a new entity that satisfies the conditions of the query will cause the iterator to go on forever. This is the most dangerous case that could happen.
Other cases which cause UB are:
deleting an entity that is not the currently iterated one, which will swap remove its current row and the last row of the archetype
adding/removing a component that cause it to move to an adjacent archetype and cause the entity to be iterated more than once
Adding a new entity that satisfies the conditions of the query will cause the iterator to go on forever. This is the most dangerous case that could happen.
Other cases which cause UB are: