-
-
Notifications
You must be signed in to change notification settings - Fork 464
Closed
Labels
Buggeneral bugs; can be anythinggeneral bugs; can be anything
Description
Help us help you
- I have checked that my issue doesn't exist yet.
- I have tried my absolute best to reduce the problem-space and have provided the absolute smallest test-case possible.
- I can always reproduce the issue with the provided description below.
Environment
- Operating System version: Windows 10
- Game/AppID (with version if applicable): CS:GO 740 1.37.9.6/13796 1305/8278
- Current SourceMod version: 1.10.0.6510
- Current SourceMod snapshot: 1.11.0.6729
- Current Metamod: Source snapshot: 1.12.0-dev+1149
- I have updated SourceMod to the latest version and it still happens.
- I have updated SourceMod to the latest snapshot and it still happens.
- I have updated SourceMM to the latest snapshot and it still happens.
Description
If plugin can't to resize ArrayList in constructor, keep size 0 without errors.
sourcemod/core/logic/smn_adt_array.cpp
Lines 76 to 79 in 0b468f2
| if (params[2]) | |
| { | |
| array->resize(params[2]); | |
| } |
Appear in plugins with big allocation like replay bot for bhop servers. It's bad, that this type of error is silent and unclear.
Problematic Code (or Steps to Reproduce)
Here is test case. Tested on windows and linux. Sometimes can successfully pass allocation.
public void OnPluginStart()
{
ArrayList list = new ArrayList(262144, 2000);
PrintToServer("init size %d", list.Length);
for (int i = 0; i < 2000; i++)
{
list.Set(i, 123);
}
PrintToServer("%d %d", list.Get(1999), list.Length);
}
Logs
init size 0
L 07/22/2021 - 12:52:07: [SM] Exception reported: Invalid index 0 (count: 0)
L 07/22/2021 - 12:52:07: [SM] Blaming: arraylist.smx
L 07/22/2021 - 12:52:07: [SM] Call stack trace:
L 07/22/2021 - 12:52:07: [SM] [0] ArrayList.Set
L 07/22/2021 - 12:52:07: [SM] [1] Line 7, E:\workdir\_work\arraylist\arraylist.sp::OnPluginStart
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Buggeneral bugs; can be anythinggeneral bugs; can be anything