Skip to content

Commit 0104997

Browse files
committed
misc: fix crash with really big 'all_ids' string in pci.ids.hpp
1 parent 780f9ee commit 0104997

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

include/pci.ids.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39893,13 +39893,13 @@ C ff Unassigned class
3989339893
)";
3989439894
}
3989539895

39896-
inline const std::string& all_ids = get_pci_ids();
39896+
extern const std::string& all_ids;
3989739897
inline constexpr std::array<std::string_view, 2424> pci_vendors_array = get_pci_vendors_array();
3989839898
inline constexpr std::array<int, 2424> pci_vendors_location_array = get_pci_vendors_location_array();
3989939899

3990039900
#else
3990139901

39902-
inline const std::string& all_ids = {};
39902+
extern const std::string& all_ids;
3990339903
inline constexpr std::array<std::string_view, 2424> pci_vendors_array = {};
3990439904
inline constexpr std::array<int, 2424> pci_vendors_location_array = {};
3990539905

src/util.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@
4848
#include "platform.hpp"
4949
#include "tiny-process-library/process.hpp"
5050

51+
#if !CF_ANDROID
52+
const std::string& all_ids = get_pci_ids();
53+
#else
54+
const std::string& all_ids = "";
55+
#endif
56+
5157
bool hasEnding(const std::string_view fullString, const std::string_view ending)
5258
{
5359
if (ending.length() > fullString.length())

0 commit comments

Comments
 (0)