Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: chrome/utility/chrome_content_utility_client.cc

Issue 446853002: Fix invalid array access in OnRobustJPEGDecodeImage(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/utility/chrome_content_utility_client.h" 5 #include "chrome/utility/chrome_content_utility_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 Send(new ChromeUtilityHostMsg_CreateZipFile_Succeeded()); 225 Send(new ChromeUtilityHostMsg_CreateZipFile_Succeeded());
226 else 226 else
227 Send(new ChromeUtilityHostMsg_CreateZipFile_Failed()); 227 Send(new ChromeUtilityHostMsg_CreateZipFile_Failed());
228 ReleaseProcessIfNeeded(); 228 ReleaseProcessIfNeeded();
229 } 229 }
230 #endif // defined(OS_CHROMEOS) 230 #endif // defined(OS_CHROMEOS)
231 231
232 void ChromeContentUtilityClient::OnRobustJPEGDecodeImage( 232 void ChromeContentUtilityClient::OnRobustJPEGDecodeImage(
233 const std::vector<unsigned char>& encoded_data) { 233 const std::vector<unsigned char>& encoded_data) {
234 // Our robust jpeg decoding is using IJG libjpeg. 234 // Our robust jpeg decoding is using IJG libjpeg.
235 if (gfx::JPEGCodec::JpegLibraryVariant() == gfx::JPEGCodec::IJG_LIBJPEG) { 235 if (gfx::JPEGCodec::JpegLibraryVariant() == gfx::JPEGCodec::IJG_LIBJPEG &&
236 !encoded_data.empty()) {
236 scoped_ptr<SkBitmap> decoded_image(gfx::JPEGCodec::Decode( 237 scoped_ptr<SkBitmap> decoded_image(gfx::JPEGCodec::Decode(
237 &encoded_data[0], encoded_data.size())); 238 &encoded_data[0], encoded_data.size()));
238 if (!decoded_image.get() || decoded_image->empty()) { 239 if (!decoded_image.get() || decoded_image->empty()) {
239 Send(new ChromeUtilityHostMsg_DecodeImage_Failed()); 240 Send(new ChromeUtilityHostMsg_DecodeImage_Failed());
240 } else { 241 } else {
241 Send(new ChromeUtilityHostMsg_DecodeImage_Succeeded(*decoded_image)); 242 Send(new ChromeUtilityHostMsg_DecodeImage_Succeeded(*decoded_image));
242 } 243 }
243 } else { 244 } else {
244 Send(new ChromeUtilityHostMsg_DecodeImage_Failed()); 245 Send(new ChromeUtilityHostMsg_DecodeImage_Failed());
245 } 246 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 const std::string& mime_type, int64 total_size, bool get_attached_images) { 302 const std::string& mime_type, int64 total_size, bool get_attached_images) {
302 // Only one IPCDataSource may be created and added to the list of handlers. 303 // Only one IPCDataSource may be created and added to the list of handlers.
303 metadata::IPCDataSource* source = new metadata::IPCDataSource(total_size); 304 metadata::IPCDataSource* source = new metadata::IPCDataSource(total_size);
304 handlers_.push_back(source); 305 handlers_.push_back(source);
305 306
306 metadata::MediaMetadataParser* parser = new metadata::MediaMetadataParser( 307 metadata::MediaMetadataParser* parser = new metadata::MediaMetadataParser(
307 source, mime_type, get_attached_images); 308 source, mime_type, get_attached_images);
308 parser->Start(base::Bind(&FinishParseMediaMetadata, base::Owned(parser))); 309 parser->Start(base::Bind(&FinishParseMediaMetadata, base::Owned(parser)));
309 } 310 }
310 #endif 311 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698