SilvDev / Left4DHooks

Left 4 Downtown and L4D Direct conversion and merger.
GNU General Public License v3.0
49 stars 11 forks source link

L4D2Direct_GetSIClassDeathTimer throws an exception when the special infected type is Charger #5

Closed PencilMario closed 1 year ago

PencilMario commented 1 year ago

encountered an exception when I called L4D2Direct_GetSIClassDeathTimer with the special infected type as Charger. Here is the error log:

L 06/17/2023 - 11:33:23: [SM] Exception reported: Array index out-of-bounds (index 6, limit 6)
L 06/17/2023 - 11:33:23: [SM] Blaming: left4dhooks.smx
L 06/17/2023 - 11:33:23: [SM] Call stack trace:
L 06/17/2023 - 11:33:23: [SM]   [1] Line 3489, l4dd\l4dd_natives.sp::Direct_GetSIClassDeathTimer
L 06/17/2023 - 11:33:23: [SM]   [3] L4D2Direct_GetSIClassDeathTimer
L 06/17/2023 - 11:33:23: [SM]   [4] Line 210, e:\GithubKu\L4D2-Not0721Here-CoopSvPlugins\addons\sourcemod\scripting\l4d_teamspanel.sp::BuildPrintPanel
L 06/17/2023 - 11:33:23: [SM]   [5] Line 604, e:\GithubKu\L4D2-Not0721Here-CoopSvPlugins\addons\sourcemod\scripting\l4d_teamspanel.sp::RefreshPanel

After my investigation, I found that in l4dd_native, the expected parameter range is 1-6 https://github.com/SilvDev/Left4DHooks/blob/129044794b73934fff22fa832ba74a58851f7c1e/sourcemod/scripting/l4dd/l4dd_natives.sp#L3430-L3441 But in l4dd_gamedata, the L4D2IntervalTimer_Offsets index range is 0-5 https://github.com/SilvDev/Left4DHooks/blob/129044794b73934fff22fa832ba74a58851f7c1e/sourcemod/scripting/l4dd/l4dd_gamedata.sp#L2118-L2123

I think this is a bug and it should be fixed by either changing the parameter range in l4dd_native or the index range in l4dd_gamedata.

If there is anything confusing, I apologize and please let me explain in detail, I used chatgpt to help draft this issue and my English is not good.

SilvDev commented 1 year ago

Thanks, fixed in 1.133.