diff options
| author | 2019-09-08 22:07:47 -0700 | |
|---|---|---|
| committer | 2019-09-08 22:07:47 -0700 | |
| commit | 76cc73e91c8be1be49ca7264d21178b0c60ccec8 (patch) | |
| tree | 0a7fa5c19d5d29d40aab5181e0ee02e4f73f0362 /services/surfaceflinger/Layer.cpp | |
| parent | b9a4f9efdd42eaaf495b9433db2fc5db3a813b94 (diff) | |
| parent | 5d5329644df97df2718a63c29345fdc17a75b9b5 (diff) | |
Merge qt-r1-dev-plus-aosp-without-vendor (5817612) into stage-aosp-master
Bug: 135460123
Change-Id: I02a643052e3023ac029cdec76ee24dfa99d82b29
Merged-In: Ied9a812f235e2a5146381b0ac8c602db1c6035f5
Diffstat (limited to 'services/surfaceflinger/Layer.cpp')
| -rw-r--r-- | services/surfaceflinger/Layer.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 1318bc0b2a..d6e86eb0e5 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -2037,6 +2037,13 @@ bool Layer::isRemovedFromCurrentState() const { return mRemovedFromCurrentState; } +// Debug helper for b/137560795 +#define INT32_MIGHT_OVERFLOW(n) (((n) >= INT32_MAX / 2) || ((n) <= INT32_MIN / 2)) + +#define RECT_BOUNDS_INVALID(rect) \ + (INT32_MIGHT_OVERFLOW((rect).left) || INT32_MIGHT_OVERFLOW((rect).right) || \ + INT32_MIGHT_OVERFLOW((rect).bottom) || INT32_MIGHT_OVERFLOW((rect).top)) + InputWindowInfo Layer::fillInputInfo() { InputWindowInfo info = mDrawingState.inputInfo; @@ -2066,6 +2073,26 @@ InputWindowInfo Layer::fillInputInfo() { layerBounds = getCroppedBufferSize(getDrawingState()); } layerBounds = t.transform(layerBounds); + + // debug check for b/137560795 + { + if (RECT_BOUNDS_INVALID(layerBounds)) { + ALOGE("layer %s bounds are invalid (%" PRIi32 ", %" PRIi32 ", %" PRIi32 ", %" PRIi32 + ")", + mName.c_str(), layerBounds.left, layerBounds.top, layerBounds.right, + layerBounds.bottom); + std::string out; + getTransform().dump(out, "Transform"); + ALOGE("%s", out.c_str()); + layerBounds.left = layerBounds.top = layerBounds.right = layerBounds.bottom = 0; + } + + if (INT32_MIGHT_OVERFLOW(xSurfaceInset) || INT32_MIGHT_OVERFLOW(ySurfaceInset)) { + ALOGE("layer %s surface inset are invalid (%" PRIi32 ", %" PRIi32 ")", mName.c_str(), + int32_t(xSurfaceInset), int32_t(ySurfaceInset)); + xSurfaceInset = ySurfaceInset = 0; + } + } layerBounds.inset(xSurfaceInset, ySurfaceInset, xSurfaceInset, ySurfaceInset); // Input coordinate should match the layer bounds. |