Might it be a BUG within DXUT?

The CGrowableArray template(dxutmisc.h, line 24) may exist with a slight BUG. This copy constructor not initialize three data members, so if you use this copy constructor, your program will crash!

Solve it very simple! Modify it as follow:

    CGrowableArray( const CGrowableArray<TYPE>& a ) :  m_pData (0),
    m_nSize(0), m_nMaxSize(0)

   {

      for( int i=0; i < a.m_nSize; i++ ) Add( a.m_pDataIdea  );

  }

  I wish next edition of DirectX SDK has solved it.

My home language is chinese, my Englist is not too very good, and honestly hope you understand what I said.



Answer this question

Might it be a BUG within DXUT?

  • bronco lane

    Thanks for your reply. :-)
  • Paul Nystrom - MSFT

    I just wanted to confirm that I ran into this bug as well and that the fix appears to be correct. I will file a bug against the DirectX team and will try to get this fixed soon.

  • Reza Bemanian

    The April 2006 version of the SDK already contains the fix:

    CGrowableArray( const CGrowableArray<TYPE>& a ) : m_pData (0), m_nSize(0), m_nMaxSize(0) { for( int i=0; i < a.m_nSize; i++ ) Add( a.m_pDataIdea ); }

    Thanks!



  • Brian A

    Hi!

    Hm, because nobody has made a comment to this, I do. :)

    Yes, seems like a bug, because the Add(..) function uses the uninitialized size member.


  • Might it be a BUG within DXUT?