Ticket #13051 (closed defect: wontfix)

Opened 2 years ago

Last modified 2 years ago

Application hung (infinite loop) if the same class-name is used twice for different classes with event tables

Reported by: gal_wxwidgets Owned by:
Priority: normal Milestone: 2.8.12
Component: base Version: 2.8.11
Keywords: Cc: gal_wxwidgets@…
Blocked By: Patch: yes
Blocking:

Description

Notes and references


The bug + patch is also available with Ubuntu bug  https://launchpad.net/bugs/735462

What you expected to happen


The wxwidgets should check for duplicate insertion into the event table and flag a duplicate insert of the same class as an erro

What happened instead


The second insert (of the same table) did succeed and create a cycle within the linked list.
On initialization, the initialization of the linked list entered an infinite loop

Description of patch


Add a check for the error case of "duplicate insert into the linked-list of the event tables"

Details


If a duplicate insert is detected, then issue an error and avoid the re-insert. It is then, the responsibility of the developer of the program, to fix the error within his code and to avoid using the same class name twice.

Reproducing the error case that this patch detect


  1. Create a class (within your program) that has the same class-name as a class that already exist within the wxwidgets code. Both classes should have event tables.
  2. Compile this code into your executable
  3. Link with a shared version of the wxwidgets libraries
  4. Start the application:
    1. The executable is initiated (before calling main()) - and the event table is added to the link list for the first time
    2. The shared libraries of the wxwidgets are initiated
      1. The event table from the wxwidgets shared library is resolved to the symbol from the executable (with the same name) and NOT to the symbol within the shared library
      2. The SAME event table is added for the SECOND time into the linked list and create a cycle
  5. main() is called
    1. wxwidget is initialize - and it get stack with an infinite loop when trying to initiate the linked list of the event table

Creating the patch


  1. Get sources
    svn checkout http://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH wxWidgets-2.8
    
  2. Apply the patch at http://trac.wxwidgets.org/browser/branches/WX_2_8_BRANCH/src/common/event.cpp#L815
  3. get diff
    svn diff wxWidgets-2.8 > check-for-cycle-dependency.patch
    

Attachments

check-for-cycle-dependency.patch download (1.0 KB) - added by gal_wxwidgets 2 years ago.
check-for-cycle-dependency.patch

Change History

Changed 2 years ago by gal_wxwidgets

check-for-cycle-dependency.patch

Changed 2 years ago by gal_wxwidgets

See also #13053 for newer 2.9-svn trunc

Changed 2 years ago by vadz

  • status changed from new to closed
  • resolution set to wontfix

In addition to what I wrote in #13053, this doesn't qualify as a serious bug fix so IMO it shouldn't be applied to 2.8 branch.

Note: See TracTickets for help on using tickets.