| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <string.h> | 5 #include <string.h> |
| 6 | 6 |
| 7 #include "chrome/common/ipc_message.h" | 7 #include "chrome/common/ipc_message.h" |
| 8 #include "chrome/common/ipc_message_utils.h" | 8 #include "chrome/common/ipc_message_utils.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // Also test the corrupt case. | 77 // Also test the corrupt case. |
| 78 IPC::Message bad_msg(1, 2, IPC::Message::PRIORITY_NORMAL); | 78 IPC::Message bad_msg(1, 2, IPC::Message::PRIORITY_NORMAL); |
| 79 // Copy the first message block over to |bad_msg|. | 79 // Copy the first message block over to |bad_msg|. |
| 80 const char* fixed_data; | 80 const char* fixed_data; |
| 81 int fixed_data_size; | 81 int fixed_data_size; |
| 82 iter = NULL; | 82 iter = NULL; |
| 83 msg.ReadData(&iter, &fixed_data, &fixed_data_size); | 83 msg.ReadData(&iter, &fixed_data, &fixed_data_size); |
| 84 bad_msg.WriteData(fixed_data, fixed_data_size); | 84 bad_msg.WriteData(fixed_data, fixed_data_size); |
| 85 // Add some bogus pixel data. | 85 // Add some bogus pixel data. |
| 86 const size_t bogus_pixels_size = bitmap.getSize() * 2; | 86 const size_t bogus_pixels_size = bitmap.getSize() * 2; |
| 87 scoped_ptr<char> bogus_pixels(new char[bogus_pixels_size]); | 87 scoped_array<char> bogus_pixels(new char[bogus_pixels_size]); |
| 88 memset(bogus_pixels.get(), 'B', bogus_pixels_size); | 88 memset(bogus_pixels.get(), 'B', bogus_pixels_size); |
| 89 bad_msg.WriteData(bogus_pixels.get(), bogus_pixels_size); | 89 bad_msg.WriteData(bogus_pixels.get(), bogus_pixels_size); |
| 90 // Make sure we don't read out the bitmap! | 90 // Make sure we don't read out the bitmap! |
| 91 SkBitmap bad_output; | 91 SkBitmap bad_output; |
| 92 iter = NULL; | 92 iter = NULL; |
| 93 EXPECT_FALSE(IPC::ParamTraits<SkBitmap>::Read(&bad_msg, &iter, &bad_output)); | 93 EXPECT_FALSE(IPC::ParamTraits<SkBitmap>::Read(&bad_msg, &iter, &bad_output)); |
| 94 } | 94 } |
| OLD | NEW |