diff options
| author | 2017-12-14 13:27:10 -0800 | |
|---|---|---|
| committer | 2017-12-19 15:12:09 -0800 | |
| commit | 054888fddbf8a5f62ebd65c10c849ff00b46c63c (patch) | |
| tree | 08a2c41709d92dd4644e95d526819d30da68856b | |
| parent | a9c7e6d15201dbb701dc1f535689910a581912b0 (diff) | |
Fix sanitizer in setViewportAndProjection.
On integer sanitized builds calculating b (and possibly t) throws a
runtime error due to an unsigned integer overflow occuring.
runtime error: unsigned integer overflow: 1024 - 1920 cannot be
represented in type 'unsigned long'
This changes the type of b (and others) to int32_t, which matches the
types in Rect and can store the negative results above without
overflowing.
Bug: 30969751
Test: Compiles, surfaceflinger tests pass.
Change-Id: Ifb45e3c7e14a2f782412e65d56e462e7df37faba
Merged-In: Ifb45e3c7e14a2f782412e65d56e462e7df37faba
| -rw-r--r-- | services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp b/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp index 37a530b33a..9c0af8b2ed 100644 --- a/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp +++ b/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp @@ -166,12 +166,12 @@ void GLES20RenderEngine::setViewportAndProjection( size_t vpw, size_t vph, Rect sourceCrop, size_t hwh, bool yswap, Transform::orientation_flags rotation) { - size_t l = sourceCrop.left; - size_t r = sourceCrop.right; + int32_t l = sourceCrop.left; + int32_t r = sourceCrop.right; // In GL, (0, 0) is the bottom-left corner, so flip y coordinates - size_t t = hwh - sourceCrop.top; - size_t b = hwh - sourceCrop.bottom; + int32_t t = hwh - sourceCrop.top; + int32_t b = hwh - sourceCrop.bottom; mat4 m; if (yswap) { |