1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00
vcmi/client
Sergei Trofimovich e4dd2f6dd8 client/lobby/SelectionTab.cpp: initialize generalSortingBy before use
Noticed use of uninitialized value when built vcmi with -fsanitize=undefined:

```
  Established connection with
    VCMI 0.99 b310f2e61e (server).
    UUID: bab9a90d-7416-4566-8817-e367ffcac7c1
  ../vcmi-9999/client/lobby/SelectionTab.cpp:138:16:
    runtime error: load of value 32717, which is not a valid value for type 'ESortBy'
  /usr/lib/gcc/x86_64-pc-linux-gnu/12.0.0/include/g++-v12/tuple:190:4:
    runtime error: load of value 32717, which is not a valid value for type 'ESortBy'
  /usr/lib/gcc/x86_64-pc-linux-gnu/12.0.0/include/g++-v12/tuple:190:4:
    runtime error: load of value 32717, which is not a valid value for type 'ESortBy'
```

Here (before the change) `SelectionTab()` used `generalSortingBy` before
first use:

```
    SelectionTab::SelectionTab(ESelectionScreen Type) {
        ...
        if(tabType != ESelectionScreen::campaignList)
        {
            ...
                ESortBy criteria = (ESortBy)i;
                if(criteria == _name)
                    criteria = generalSortingBy;

                buttonsSortBy.push_back(... std::bind(&SelectionTab::sortBy, this, criteria)));
            ...
        }
        ...
        switch(tabType)
        {
        case ESelectionScreen::newGame:
                generalSortingBy = ESortBy::_name;
        ....
```

The change moves `generalSortingBy` initialization before first use.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2021-07-25 21:00:31 +03:00
..
battle Fixes for code review issues 2021-02-20 04:57:50 +03:00
gui Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
icons Changes related to Debian packaging, based on josch patch 2014-03-20 18:17:40 +00:00
lobby client/lobby/SelectionTab.cpp: initialize generalSortingBy before use 2021-07-25 21:00:31 +03:00
mainmenu Fix: 'Load' and 'Main menu' in-game buttons should work properly 2021-01-17 19:18:26 +03:00
widgets Merge branch 'develop' into handlersAbstraction 2021-07-16 00:32:13 +03:00
windows Fixes for code review issues 2021-02-20 04:57:50 +03:00
CBitmapHandler.cpp Fixed RETURN_IF_BATTLE(). Undid disabled warnings. Fixed indentation. 2020-10-05 16:28:28 -07:00
CBitmapHandler.h Code style: move or add licensing information on top of every file 2017-07-14 01:26:03 +03:00
CGameInfo.cpp Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
CGameInfo.h Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
Client.cpp Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
Client.h Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
CMakeLists.txt CMake more transitive 2019-03-28 16:56:51 +03:00
CMessage.cpp Fixed RETURN_IF_BATTLE(). Undid disabled warnings. Fixed indentation. 2020-10-05 16:28:28 -07:00
CMessage.h Gui cleanup4 (#446) 2018-07-25 01:36:48 +03:00
CMT.cpp Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
CMT.h Full rework of pre-game interface and networking 2018-04-04 14:24:26 +07:00
CMusicHandler.cpp Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
CMusicHandler.h Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
CPlayerInterface.cpp Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
CPlayerInterface.h Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
CreatureCostBox.cpp Fixed lots of warnings. 2020-10-04 02:20:18 -07:00
CreatureCostBox.h Gui cleanup3 - UI refactoring to use smart pointers (#440) 2018-04-07 18:34:11 +07:00
CServerHandler.cpp Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
CServerHandler.h Add proper thread synchronization for campaigns 2019-03-30 00:28:33 +01:00
CVideoHandler.cpp Fixed lots of warnings. 2020-10-04 02:20:18 -07:00
CVideoHandler.h Gui cleanup4 (#446) 2018-07-25 01:36:48 +03:00
DPIaware.manifest Fixed issue with Windows 7 DPI upscaling. 2009-12-12 03:26:09 +00:00
Graphics.cpp Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
Graphics.h Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
mapHandler.cpp Fixed RETURN_IF_BATTLE(). Undid disabled warnings. Fixed indentation. 2020-10-05 16:28:28 -07:00
mapHandler.h Fixed lots of warnings. 2020-10-04 02:20:18 -07:00
NetPacksClient.cpp Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
NetPacksLobbyClient.cpp Remove empty branch from LobbyClientConnected::applyOnLobbyScreen (#507) 2018-10-30 04:59:02 +03:00
resource.h Added icon to the MSVC project, minor fixes, version bumped to 0.74. 2009-10-01 20:00:21 +00:00
SDLMain.h Mac OS patch from stopiccot 2012-12-01 06:30:52 +00:00
SDLMain.m Mac OS patch from stopiccot 2012-12-01 06:30:52 +00:00
SDLRWwrapper.cpp copyright stuff 2016-01-31 11:13:56 +01:00
SDLRWwrapper.h Code style: move or add licensing information on top of every file 2017-07-14 01:26:03 +03:00
StdInc.cpp * Final commit 2011-12-13 21:35:28 +00:00
StdInc.h Implemented SDL2 unicode input. Hotkeys are sill broken. 2014-06-13 07:55:42 +04:00
VCMI_client.cbp Entities redesign and a few ERM features 2021-02-14 19:05:43 +03:00
VCMI_client.rc don't use separate .rc files for MSVC and MinGW 2014-10-12 16:32:02 +03:00
VCMI_client.vcxproj Update VS files to 2019, partially fix test project 2019-06-09 17:28:55 +02:00
VCMI_client.vcxproj.filters Update project files to match vcmi code changes 2018-07-06 18:52:51 +02:00
vcmi.ico Added icon to the MSVC project, minor fixes, version bumped to 0.74. 2009-10-01 20:00:21 +00:00