| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/browser/android/webapk/webapk_icon_hasher.h" | 5 #include "chrome/browser/android/webapk/webapk_icon_hasher.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "net/http/http_status_code.h" | 9 #include "net/http/http_status_code.h" |
| 10 #include "net/url_request/url_fetcher.h" | 10 #include "net/url_request/url_fetcher.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 callback_.Run(""); | 40 callback_.Run(""); |
| 41 return; | 41 return; |
| 42 } | 42 } |
| 43 | 43 |
| 44 // WARNING: We are running in the browser process. |raw_image_data| is the | 44 // WARNING: We are running in the browser process. |raw_image_data| is the |
| 45 // image's raw, unsanitized bytes from the web. |raw_image_data| may contain | 45 // image's raw, unsanitized bytes from the web. |raw_image_data| may contain |
| 46 // malicious data. Decoding unsanitized bitmap data to an SkBitmap in the | 46 // malicious data. Decoding unsanitized bitmap data to an SkBitmap in the |
| 47 // browser process is a security bug. | 47 // browser process is a security bug. |
| 48 std::string raw_image_data; | 48 std::string raw_image_data; |
| 49 source->GetResponseAsString(&raw_image_data); | 49 source->GetResponseAsString(&raw_image_data); |
| 50 uint64_t hash = MurmurHash64B(&raw_image_data.front(), raw_image_data.size(), | 50 uint64_t hash = MurmurHash64A(&raw_image_data.front(), raw_image_data.size(), |
| 51 kMurmur2HashSeed); | 51 kMurmur2HashSeed); |
| 52 callback_.Run(base::Uint64ToString(hash)); | 52 callback_.Run(base::Uint64ToString(hash)); |
| 53 } | 53 } |
| OLD | NEW |