Fix memory corruption in heightForWidth cache

Overflowing q_firstCachedHfw caused memory to be overwritten
before q_cachedHfws.

Change-Id: Ibbcc72380f426550cc0569a05c54cd1acd878b33
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
bb10
Harald Brinkmann 2018-03-27 09:45:03 +02:00 committed by Jan Arve Sæther
parent 18a1cfaba3
commit c067083057
1 changed files with 1 additions and 1 deletions

View File

@ -839,7 +839,7 @@ int QWidgetItemV2::heightForWidth(int width) const
const QSize &size = q_cachedHfws[offset % HfwCacheMaxSize];
if (size.width() == width) {
if (q_hfwCacheSize == HfwCacheMaxSize)
q_firstCachedHfw = offset;
q_firstCachedHfw = offset % HfwCacheMaxSize;
return size.height();
}
}