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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_util.cc

Issue 39206: NO CODE CHANGE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 | Annotate | Revision Log
OLDNEW
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 "chrome/browser/safe_browsing/safe_browsing_util.h" 5 #include "chrome/browser/safe_browsing/safe_browsing_util.h"
6 6
7 #include "base/hmac.h" 7 #include "base/hmac.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/sha2.h" 9 #include "base/sha2.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 while (GetNextEntry(&entry)) { 488 while (GetNextEntry(&entry)) {
489 if (entry->list_id() == list_id && 489 if (entry->list_id() == list_id &&
490 entry->chunk_id() == chunk_id && 490 entry->chunk_id() == chunk_id &&
491 entry->IsSub() && 491 entry->IsSub() &&
492 entry->prefix_count() == 0) { 492 entry->prefix_count() == 0) {
493 continue; 493 continue;
494 } 494 }
495 495
496 SBEntry* new_sub_entry = const_cast<SBEntry*>(entry); 496 SBEntry* new_sub_entry = const_cast<SBEntry*>(entry);
497 scoped_array<char> data; 497 scoped_array<char> data;
498 if (entry->IsSub() && entry->list_id() == list_id && entry->prefix_count()) { 498 if (entry->IsSub() && entry->list_id() == list_id &&
499 entry->prefix_count()) {
499 // Make a copy of the entry so that we can modify it. 500 // Make a copy of the entry so that we can modify it.
500 data.reset(new char[entry->Size()]); 501 data.reset(new char[entry->Size()]);
501 new_sub_entry = reinterpret_cast<SBEntry*>(data.get()); 502 new_sub_entry = reinterpret_cast<SBEntry*>(data.get());
502 memcpy(new_sub_entry, entry, entry->Size()); 503 memcpy(new_sub_entry, entry, entry->Size());
503 // Remove any matching prefixes. 504 // Remove any matching prefixes.
504 for (int i = 0; i < new_sub_entry->prefix_count(); ++i) { 505 for (int i = 0; i < new_sub_entry->prefix_count(); ++i) {
505 if (new_sub_entry->ChunkIdAtPrefix(i) == chunk_id) 506 if (new_sub_entry->ChunkIdAtPrefix(i) == chunk_id)
506 new_sub_entry->RemovePrefix(i--); 507 new_sub_entry->RemovePrefix(i--);
507 } 508 }
508 509
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 630
630 // Validate that the next entry is wholly contained inside of |data_|. 631 // Validate that the next entry is wholly contained inside of |data_|.
631 const char* end = data_.get() + size_; 632 const char* end = data_.get() + size_;
632 if (next + SBEntry::kMinSize <= end && next + next_entry->Size() <= end) { 633 if (next + SBEntry::kMinSize <= end && next + next_entry->Size() <= end) {
633 *entry = next_entry; 634 *entry = next_entry;
634 return true; 635 return true;
635 } 636 }
636 637
637 return false; 638 return false;
638 } 639 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_database_bloom.cc ('k') | chrome/browser/search_engines/template_url_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698