sw_engine: fix potential data overflow.

Change-Id: Ie800fda74d44ad3741f7a92f12681f7f753ee50c
This commit is contained in:
Hermet Park 2020-08-13 19:50:46 +09:00
parent 3b9bb51321
commit ac4405a4ec

View file

@ -377,7 +377,7 @@ SwFixed mathLength(SwPoint& pt)
_polarize(v); _polarize(v);
v.x = _downscale(v.x); v.x = _downscale(v.x);
if (shift > 0) return (v.x + (1 << (shift -1))) >> shift; if (shift > 0) return (v.x + (static_cast<SwFixed>(1) << (shift -1))) >> shift;
return static_cast<SwFixed>((uint32_t)v.x << -shift); return static_cast<SwFixed>((uint32_t)v.x << -shift);
} }