summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-09-27 15:30:15 +0200
committerMarc Mutz <marc.mutz@kdab.com>2016-11-22 11:32:13 +0000
commit34c2a1dcf05661562cd00fe6dbdf884d8917933d (patch)
tree0548c89b2fa144b36a07bdde934d4239e08d26e8 /src/corelib/thread
parent7920cfe46ad11ce1cd5592a71cfa16422e9207e1 (diff)
QFormLayout: fix use-after-free in clearQLayoutItem()
Found by ASan when it should have been found by me in the initial review... The old code did, in this order: 1. delete item->layout() (which deletes item, as QLayoutItem::layout() is just a dynamic_cast implemented with virtual functions) 2. delete item->widget() (which is correct, but too late, as 'item' may have already been deleted; this is the first use-after-free bug) 3. delete item->spacerItem() (which is the second use-after-free). Fix by deleting item->widget() (which may be a no-op), _then_ checking for a QLayout, deleting all children (but not the layout), and finally deleting item as a QLayoutItem. Rename clearQLayoutItem() to clearAndDestroyQLayoutItem() to better match what it actually does. Change-Id: Id70a7a137dac5de466ef619f01bfd61dfc150418 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Samuel Gaist <samuel.gaist@edeltech.ch> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/corelib/thread')
0 files changed, 0 insertions, 0 deletions