Skip to content

Commit

Permalink
[ATL] Assert on 'short circuiting' the list
Browse files Browse the repository at this point in the history
If you try to append the list consisting of two or more elements to itself, you will end up in an infinite loop and leak memory.
  • Loading branch information
SigmaTel71 committed Sep 30, 2024
1 parent 7be1e7d commit 075ed9b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sdk/lib/atl/atlcoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ POSITION CAtlList<E, ETraits>::AddTail(INARGTYPE element)
template <typename E, class ETraits>
void CAtlList<E, ETraits>::AddHeadList(_In_ const CAtlList<E, ETraits>* plNew)
{
ATLASSERT(plNew != NULL);
ATLASSERT(plNew != NULL && plNew != this);

POSITION pos = plNew->GetTailPosition();

Expand All @@ -659,7 +659,7 @@ void CAtlList<E, ETraits>::AddHeadList(_In_ const CAtlList<E, ETraits>* plNew)
template <typename E, class ETraits>
void CAtlList<E, ETraits>::AddTailList(_In_ const CAtlList<E, ETraits>* plNew)
{
ATLASSERT(plNew != NULL);
ATLASSERT(plNew != NULL && plNew != this);

POSITION pos = plNew->GetHeadPosition();

Expand Down

0 comments on commit 075ed9b

Please sign in to comment.