@@ -593,7 +593,7 @@ void CWebCore::AddAllowedPage(const SString& strURL, eWebFilterType filterType)
593593 std::lock_guard<std::recursive_mutex> lock (m_FilterMutex);
594594
595595 // Prevent unbounded whitelist growth - remove old REQUEST entries if limit reached
596- if (m_Whitelist.size () >= MAX_WHITELIST_SIZE )
596+ if (m_Whitelist.size () >= 50000 )
597597 {
598598 // Remove WEBFILTER_REQUEST entries (temporary session entries)
599599 for (auto iter = m_Whitelist.begin (); iter != m_Whitelist.end ();)
@@ -613,7 +613,7 @@ void CWebCore::AddBlockedPage(const SString& strURL, eWebFilterType filterType)
613613 std::lock_guard<std::recursive_mutex> lock (m_FilterMutex);
614614
615615 // Prevent unbounded whitelist growth - remove old REQUEST entries if limit reached
616- if (m_Whitelist.size () >= MAX_WHITELIST_SIZE )
616+ if (m_Whitelist.size () >= 50000 )
617617 {
618618 // Remove WEBFILTER_REQUEST entries (temporary session entries)
619619 for (auto iter = m_Whitelist.begin (); iter != m_Whitelist.end ();)
@@ -762,7 +762,7 @@ void CWebCore::ProcessInputMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
762762 if ((keyEvent.type == KEYEVENT_CHAR) && isKeyDown (VK_RMENU))
763763 {
764764 HKL current_layout = ::GetKeyboardLayout (0 );
765- SHORT scan_res = ::VkKeyScanExW (wParam, current_layout);
765+ SHORT scan_res = ::VkKeyScanExW (static_cast <WCHAR>( wParam) , current_layout);
766766 if ((HIBYTE (scan_res) & (2 | 4 )) == (2 | 4 ))
767767 {
768768 keyEvent.modifiers &= ~(EVENTFLAG_CONTROL_DOWN | EVENTFLAG_ALT_DOWN);
@@ -1023,6 +1023,9 @@ void CWebCore::StaticFetchRevisionFinished(const SHttpDownloadResult& result)
10231023
10241024 if (result.bSuccess )
10251025 {
1026+ if (result.dataSize > 1024 * 1024 ) [[unlikely]]
1027+ return ;
1028+
10261029 SString strData = result.pData ;
10271030 SString strWhiteRevision, strBlackRevision;
10281031 strData.Split (" ;" , &strWhiteRevision, &strBlackRevision);
@@ -1070,10 +1073,21 @@ void CWebCore::StaticFetchWhitelistFinished(const SHttpDownloadResult& result)
10701073 if (!pWebCore->MakeSureXMLNodesExist ())
10711074 return ;
10721075
1076+ if (result.dataSize > 5 * 1024 * 1024 ) [[unlikely]]
1077+ {
1078+ return ;
1079+ }
1080+
10731081 CXMLNode* pRootNode = pWebCore->m_pXmlConfig ->GetRootNode ();
10741082 std::vector<SString> whitelist;
10751083 SString strData = result.pData ;
10761084 strData.Split (" ;" , whitelist);
1085+
1086+ if (whitelist.size () > 50000 ) [[unlikely]]
1087+ {
1088+ whitelist.resize (50000 );
1089+ }
1090+
10771091 CXMLNode* pListNode = pRootNode->FindSubNode (" globalwhitelist" );
10781092 if (!pListNode)
10791093 return ;
@@ -1116,10 +1130,21 @@ void CWebCore::StaticFetchBlacklistFinished(const SHttpDownloadResult& result)
11161130 if (!pWebCore->MakeSureXMLNodesExist ())
11171131 return ;
11181132
1133+ if (result.dataSize > 5 * 1024 * 1024 ) [[unlikely]]
1134+ {
1135+ return ;
1136+ }
1137+
11191138 CXMLNode* pRootNode = pWebCore->m_pXmlConfig ->GetRootNode ();
11201139 std::vector<SString> blacklist;
11211140 SString strData = result.pData ;
11221141 strData.Split (" ;" , blacklist);
1142+
1143+ if (blacklist.size () > 50000 ) [[unlikely]]
1144+ {
1145+ blacklist.resize (50000 );
1146+ }
1147+
11231148 CXMLNode* pListNode = pRootNode->FindSubNode (" globalblacklist" );
11241149 if (!pListNode)
11251150 return ;
0 commit comments