summaryrefslogtreecommitdiff
path: root/libs/gui/LayerState.cpp
diff options
context:
space:
mode:
author Michael Lentine <mlentine@google.com> 2014-10-31 23:37:47 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2014-10-31 23:37:47 +0000
commit793fc0e13d25bdecda1219999f8be2cb3c121d20 (patch)
tree9e544c52b7107d0de69ade09ee272a01c0782ef3 /libs/gui/LayerState.cpp
parent9853685931298ba02066ebb50a8377ad4aa80f00 (diff)
parent8afa1c4ab86d724feb7716e153b7835385534590 (diff)
Merge "Fix crash when user provides large values in the Parcel." into lmp-mr1-dev
Diffstat (limited to 'libs/gui/LayerState.cpp')
-rw-r--r--libs/gui/LayerState.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index e95d8b6c42..1183d59215 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -55,8 +55,12 @@ status_t layer_state_t::read(const Parcel& input)
alpha = input.readFloat();
flags = input.readInt32();
mask = input.readInt32();
- matrix = *reinterpret_cast<layer_state_t::matrix22_t const *>(
- input.readInplace(sizeof(layer_state_t::matrix22_t)));
+ const void* matrix_data = input.readInplace(sizeof(layer_state_t::matrix22_t));
+ if (matrix_data) {
+ matrix = *reinterpret_cast<layer_state_t::matrix22_t const *>(matrix_data);
+ } else {
+ return BAD_VALUE;
+ }
input.read(crop);
input.read(transparentRegion);
return NO_ERROR;