Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/protocol/client_control_dispatcher.h" | 5 #include "remoting/protocol/client_control_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 !cursor_shape.has_hotspot_y()) { | 31 !cursor_shape.has_hotspot_y()) { |
| 32 LOG(ERROR) << "Cursor shape is missing required fields."; | 32 LOG(ERROR) << "Cursor shape is missing required fields."; |
| 33 return false; | 33 return false; |
| 34 } | 34 } |
| 35 | 35 |
| 36 int width = cursor_shape.width(); | 36 int width = cursor_shape.width(); |
| 37 int height = cursor_shape.height(); | 37 int height = cursor_shape.height(); |
| 38 | 38 |
| 39 // Verify that |width| and |height| are within sane limits. Otherwise integer | 39 // Verify that |width| and |height| are within sane limits. Otherwise integer |
| 40 // overflow can occur while calculating |cursor_total_bytes| below. | 40 // overflow can occur while calculating |cursor_total_bytes| below. |
| 41 if (width <= 0 || width > (SHRT_MAX / 2) || | 41 if (width < 0 || width > (SHRT_MAX / 2) || |
| 42 height <= 0 || height > (SHRT_MAX / 2)) { | 42 height < 0 || height > (SHRT_MAX / 2)) { |
|
Wez
2015/01/06 23:24:25
Since you're making this change in the client-side
| |
| 43 LOG(ERROR) << "Cursor dimensions are out of bounds for SetCursor: " | 43 LOG(ERROR) << "Cursor dimensions are out of bounds for SetCursor: " |
| 44 << width << "x" << height; | 44 << width << "x" << height; |
| 45 return false; | 45 return false; |
| 46 } | 46 } |
| 47 | 47 |
| 48 uint32 cursor_total_bytes = width * height * kBytesPerPixel; | 48 uint32 cursor_total_bytes = width * height * kBytesPerPixel; |
| 49 if (cursor_shape.data().size() < cursor_total_bytes) { | 49 if (cursor_shape.data().size() < cursor_total_bytes) { |
| 50 LOG(ERROR) << "Expected " << cursor_total_bytes << " bytes for a " | 50 LOG(ERROR) << "Expected " << cursor_total_bytes << " bytes for a " |
| 51 << width << "x" << height << " cursor. Only received " | 51 << width << "x" << height << " cursor. Only received " |
| 52 << cursor_shape.data().size() << " bytes"; | 52 << cursor_shape.data().size() << " bytes"; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 client_stub_->SetPairingResponse(message->pairing_response()); | 139 client_stub_->SetPairingResponse(message->pairing_response()); |
| 140 } else if (message->has_extension_message()) { | 140 } else if (message->has_extension_message()) { |
| 141 client_stub_->DeliverHostMessage(message->extension_message()); | 141 client_stub_->DeliverHostMessage(message->extension_message()); |
| 142 } else { | 142 } else { |
| 143 LOG(WARNING) << "Unknown control message received."; | 143 LOG(WARNING) << "Unknown control message received."; |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace protocol | 147 } // namespace protocol |
| 148 } // namespace remoting | 148 } // namespace remoting |
| OLD | NEW |