Opened 3 years ago
Closed 3 years ago
#5852 closed defect (fixed)
Dot product overflow in CCmpUnitMotion
Reported by: | Itms | Owned by: | wraitii |
---|---|---|---|
Priority: | Must Have | Milestone: | Alpha 24 |
Component: | Core engine | Keywords: | |
Cc: | Patch: | Phab:D3061 |
Description
I am not sure this has an actual impact on gameplay, but there is an overflow happening in the unit motion component (at least under r24041).
It can be reproduced by running the attached commands.txt under r24041 in Debug mode (Release mode ignores these overflows).
Relevant call stack:
> pyrogenesis_dbg.exe!CFixedVector2D::Dot(const CFixedVector2D & v) Line 216 > pyrogenesis_dbg.exe!CCmpUnitMotion::ComputeTargetPosition(CFixedVector2D & out, const CCmpUnitMotion::MoveRequest & moveRequest) Line 1152 > pyrogenesis_dbg.exe!CCmpUnitMotion::ComputeGoal(PathGoal & out, const CCmpUnitMotion::MoveRequest & moveRequest) Line 1330
Change History (3)
comment:1 by , 3 years ago
comment:2 by , 3 years ago
Milestone: | Backlog → Alpha 24 |
---|---|
Patch: | → Phab:D3061 |
Priority: | Should Have → Must Have |
Status: | assigned → new |
Note:
See TracTickets
for help on using tickets.
Undefined behaviour afaik, so potential OOS.
I can reproduce on basically any map by ordering a unit to attack a moving unit across the map.
Dot() is actually an overflow-nightmare. With vectors as low as 100x, 600y, it widely overflows (fixed can only represent up to 32768). Most of the in-game code seems to be for very small scales, which ought to be fine in most cases.
I'll divide both vectors to lower their magnitude and add a warning that Dot() overflows quickly.