summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webcursor.cc
diff options
context:
space:
mode:
Diffstat (limited to 'webkit/glue/webcursor.cc')
-rw-r--r--webkit/glue/webcursor.cc36
1 files changed, 19 insertions, 17 deletions
diff --git a/webkit/glue/webcursor.cc b/webkit/glue/webcursor.cc
index 8f76ef9..fb67b6b 100644
--- a/webkit/glue/webcursor.cc
+++ b/webkit/glue/webcursor.cc
@@ -89,26 +89,28 @@ bool WebCursor::Deserialize(const Pickle* pickle, void** iter) {
size_y > kMaxCursorDimension)
return false;
- if (type == WebCursorInfo::TypeCustom && (size_x == 0 || size_y == 0))
- return false;
-
- // The * 4 is because the expected format is an array of RGBA pixel values.
- if (size_x * size_y * 4 > data_len)
- return false;
-
type_ = type;
- hotspot_.set_x(hotspot_x);
- hotspot_.set_y(hotspot_y);
- custom_size_.set_width(size_x);
- custom_size_.set_height(size_y);
- ClampHotspot();
- custom_data_.clear();
- if (data_len > 0) {
- custom_data_.resize(data_len);
- memcpy(&custom_data_[0], data, data_len);
+ if (type == WebCursorInfo::TypeCustom) {
+ if (size_x > 0 && size_y > 0) {
+ // The * 4 is because the expected format is an array of RGBA pixel
+ // values.
+ if (size_x * size_y * 4 > data_len)
+ return false;
+
+ hotspot_.set_x(hotspot_x);
+ hotspot_.set_y(hotspot_y);
+ custom_size_.set_width(size_x);
+ custom_size_.set_height(size_y);
+ ClampHotspot();
+
+ custom_data_.clear();
+ if (data_len > 0) {
+ custom_data_.resize(data_len);
+ memcpy(&custom_data_[0], data, data_len);
+ }
+ }
}
-
return DeserializePlatformData(pickle, iter);
}