Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Placing spice outside the map bounds causes a crash #19654

Closed
abcdefg30 opened this issue Sep 6, 2021 · 1 comment · Fixed by #19656
Closed

Placing spice outside the map bounds causes a crash #19654

abcdefg30 opened this issue Sep 6, 2021 · 1 comment · Fixed by #19656

Comments

@abcdefg30
Copy link
Member

Reported on Discord by Inlines:

OpenRA engine version release-20210321
Dune 2000 mod version release-20210321
on map 31ff17b01c0ded70f6f70f651d6c436241f9ec84 (The Spice Must Flow by Inlines).
Date: 2021-09-06 01:54:58Z
Operating System: Windows (Microsoft Windows NT 6.1.7601 Service Pack 1)
Runtime Version: .NET CLR 4.0.30319.42000
Exception of type `System.IndexOutOfRangeException`: Index was outside the bounds of the array.
   at OpenRA.Mods.D2k.Traits.D2kResourceRenderer.UpdateRenderedSprite(CPos cell, RendererCellContents content)
   at OpenRA.Mods.Common.Traits.ResourceRenderer.OpenRA.Traits.IWorldLoaded.WorldLoaded(World w, WorldRenderer wr)
   at OpenRA.World.LoadComplete(WorldRenderer wr)
   at OpenRA.Game.StartGame(String mapUID, WorldType type)
   at OpenRA.Mods.Common.Widgets.Logic.MainMenuLogic.<>c__DisplayClass15_0.<LoadMapIntoEditor>b__0()
   at System.Action`1.Invoke(T obj)
   at OpenRA.Game.LogicTick()
   at OpenRA.Game.Loop()
   at OpenRA.Game.Run()
   at OpenRA.Game.InitializeAndRun(String[] args)
   at OpenRA.WindowsLauncher.WindowsLauncher.RunGame(String[] args)

@pchote
Copy link
Member

pchote commented Sep 6, 2021

var directions = CVec.Directions;
for (var i = 0; i < directions.Length; i++)
{
var neighbour = cell + directions[i];
UpdateRenderedSpriteInner(neighbour, RenderContents[neighbour]);
}

is not checking for neighbours outside the map bounds, so crashes if a cell adjacent to the map edge contains spice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants