#15174 closed defect (fixed)

wxPGPropArgCls does not initialize m_flags in the default constructor

Reported by: alexbranescu Owned by:
Priority: high Milestone:
Component: wxPropertyGrid Version: stable-latest
Keywords: Cc:
Blocked By: Blocking:
Patch: no

Description

In C++, member POD types are not automatically zero-initialized if not specified in the constructor initialization list. This can lead to a crash (and does in certain cases) with wxPGPropArgCls, because the destructor calls delete on potentially uninitialized member if m_flags has a specific value:

if ( m_flags & OwnsWxString )

delete m_ptr.stringName;

Since m_flags has an indeterminate value the if check may pass even in the default constructed object case.

Change History (2)

comment:1 Changed 17 months ago by vadz

  • Status changed from new to confirmed

I'm going to simply remove the default ctor because it doesn't seem to be needed and doesn't make any sense AFAICS. If you do use it for something (what?), please let us know.

comment:2 Changed 17 months ago by VZ

  • Resolution set to fixed
  • Status changed from confirmed to closed

(In [73898]) Remove the apparently unneeded wxPGPropArgCls default ctor.

This ctor didn't initialize the flags correctly and could result in a crash
when a default constructed object was destroyed.

Closes #15174.

Note: See TracTickets for help on using tickets.