Avoid an asan runtime error

Authored by jtamate on Mar 8 2018, 5:58 PM.

Description

Avoid an asan runtime error

Summary: Initialize the arrays to the maximum size of the enums and use c++11 initialization to ensure that all values are set to zero (or equivalent).

Test Plan:
execute kdialog --getexistingdirectory smb://

before the patch, the following messages from gcc asan are displayed:

kdesrc/frameworks/kiconthemes/src/kiconeffect.cpp:170:51: runtime error: index 3 out of bounds for type 'int [3]'
kdesrc/frameworks/kiconthemes/src/kiconeffect.cpp:172:51: runtime error: index 3 out of bounds for type 'float [3]'
kdesrc/frameworks/kiconthemes/src/kiconeffect.cpp:174:40: runtime error: index 3 out of bounds for type 'bool [3]'
kdesrc/frameworks/kiconthemes/src/kiconeffect.cpp:176:35: runtime error: index 3 out of bounds for type 'int [3]'
kdesrc/frameworks/kiconthemes/src/kiconeffect.cpp:176:74: runtime error: index 3 out of bounds for type 'int [3]'
kdesrc/frameworks/kiconthemes/src/kiconeffect.cpp:180:35: runtime error: index 3 out of bounds for type 'int [3]'

This runtime error is not shown any more.

Reviewers: Frameworks, mwolff

Reviewed By: mwolff

Subscribers: mwolff, apol, anthonyfieroni

Tags: Frameworks

Differential Revision: https://phabricator.kde.org/D11132

Details

Committed
jtamateMar 8 2018, 5:59 PM
Reviewer
mwolff
Differential Revision
D11132: Avoid an asan runtime error
Parents
R302:6ffb26242bd1: GIT_SILENT Upgrade ECM and KF5 version requirements for 5.44.0 release.
Branches
Unknown
Tags
Unknown