diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/autofill/autofill_editor_gtk.cc | 8 | ||||
-rw-r--r-- | chrome/browser/automation/testing_automation_provider.cc | 33 | ||||
-rw-r--r-- | chrome/browser/diagnostics/recon_diagnostics.cc | 6 | ||||
-rw-r--r-- | chrome/browser/geolocation/gateway_data_provider_linux.cc | 5 | ||||
-rw-r--r-- | chrome/browser/password_manager/native_backend_kwallet_x.cc | 6 | ||||
-rw-r--r-- | chrome/browser/sync/util/nigori.cc | 3 | ||||
-rw-r--r-- | chrome/browser/task_manager/task_manager.cc | 7 | ||||
-rw-r--r-- | chrome/browser/visitedlink/visitedlink_master.cc | 3 | ||||
-rw-r--r-- | chrome/browser/zygote_main_linux.cc | 6 |
9 files changed, 57 insertions, 20 deletions
diff --git a/chrome/browser/autofill/autofill_editor_gtk.cc b/chrome/browser/autofill/autofill_editor_gtk.cc index 3cdec02..8e2c999 100644 --- a/chrome/browser/autofill/autofill_editor_gtk.cc +++ b/chrome/browser/autofill/autofill_editor_gtk.cc @@ -723,9 +723,11 @@ void AutoFillCreditCardEditor::SetWidgetValues(CreditCard* card) { } int year; - base::StringToInt( - card->GetFieldText(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)), - &year); + if (!base::StringToInt( + card->GetFieldText(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)), + &year)) { + NOTREACHED(); + } if (year >= base_year_ && year < base_year_ + kNumYears) gtk_combo_box_set_active(GTK_COMBO_BOX(year_), year - base_year_); else diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index d25c07c..9b6c303 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -3729,12 +3729,15 @@ void TestingAutomationProvider::GetAutoFillProfile( Browser* browser, DictionaryValue* args, IPC::Message* reply_message) { + AutomationJSONReply reply(this, reply_message); // Get the AutoFillProfiles currently in the database. int tab_index = 0; - args->GetInteger("tab_index", &tab_index); - TabContents* tab_contents = browser->GetTabContentsAt(tab_index); - AutomationJSONReply reply(this, reply_message); + if (!args->GetInteger("tab_index", &tab_index)) { + reply.SendError("Invalid or missing tab_index integer value."); + return; + } + TabContents* tab_contents = browser->GetTabContentsAt(tab_index); if (tab_contents) { PersonalDataManager* pdm = tab_contents->profile()->GetOriginalProfile() ->GetPersonalDataManager(); @@ -3770,8 +3773,17 @@ void TestingAutomationProvider::FillAutoFillProfile( AutomationJSONReply reply(this, reply_message); ListValue* profiles = NULL; ListValue* cards = NULL; - args->GetList("profiles", &profiles); - args->GetList("credit_cards", &cards); + + if (!args->GetList("profiles", &profiles)) { + reply.SendError("Invalid or missing profiles list"); + return; + } + + if (!args->GetList("credit_cards", &cards)) { + reply.SendError("Invalid or missing credit_cards list"); + return; + } + std::string error_mesg; std::vector<AutoFillProfile> autofill_profiles; @@ -3791,7 +3803,11 @@ void TestingAutomationProvider::FillAutoFillProfile( // Save the AutoFillProfiles. int tab_index = 0; - args->GetInteger("tab_index", &tab_index); + if (!args->GetInteger("tab_index", &tab_index)) { + reply.SendError("Invalid or missing tab_index integer"); + return; + } + TabContents* tab_contents = browser->GetTabContentsAt(tab_index); if (tab_contents) { @@ -3984,7 +4000,10 @@ void TestingAutomationProvider::DisableSyncForDatatypes( return; } std::string first_datatype; - datatypes->GetString(0, &first_datatype); + if (!datatypes->GetString(0, &first_datatype)) { + reply.SendError("Invalid or missing string"); + return; + } if (first_datatype == "All") { sync_waiter_->DisableSyncForAllDatatypes(); ProfileSyncService::Status status = sync_waiter_->GetStatus(); diff --git a/chrome/browser/diagnostics/recon_diagnostics.cc b/chrome/browser/diagnostics/recon_diagnostics.cc index 5752014..ac0548b 100644 --- a/chrome/browser/diagnostics/recon_diagnostics.cc +++ b/chrome/browser/diagnostics/recon_diagnostics.cc @@ -328,7 +328,11 @@ class JSONTest : public DiagnosticTest { return true; } int64 file_size; - file_util::GetFileSize(path_, &file_size); + if (!file_util::GetFileSize(path_, &file_size)) { + RecordFailure(ASCIIToUTF16("Cannot obtain file size")); + return true; + } + if (file_size > max_file_size_) { RecordFailure(ASCIIToUTF16("File too big")); return true; diff --git a/chrome/browser/geolocation/gateway_data_provider_linux.cc b/chrome/browser/geolocation/gateway_data_provider_linux.cc index f1779cb..e8f8cf4 100644 --- a/chrome/browser/geolocation/gateway_data_provider_linux.cc +++ b/chrome/browser/geolocation/gateway_data_provider_linux.cc @@ -40,9 +40,10 @@ std::string HexToIpv4Format(std::string& hex_address) { if (hex_address.size() != 8) return ""; std::vector<uint8> bytes; - base::HexStringToBytes(hex_address, &bytes); - if (bytes.size() != 4) + if (!base::HexStringToBytes(hex_address, &bytes) || + bytes.size() != 4) { return ""; + } struct in_addr in; uint32 ip_native_endian; memcpy(&ip_native_endian, &bytes[0], 4); diff --git a/chrome/browser/password_manager/native_backend_kwallet_x.cc b/chrome/browser/password_manager/native_backend_kwallet_x.cc index 31dc154..8754cd9 100644 --- a/chrome/browser/password_manager/native_backend_kwallet_x.cc +++ b/chrome/browser/password_manager/native_backend_kwallet_x.cc @@ -534,7 +534,11 @@ void NativeBackendKWallet::DeserializeValue(const string& signon_realm, void NativeBackendKWallet::ReadGURL(const Pickle& pickle, void** iter, GURL* url) { string url_string; - pickle.ReadString(iter, &url_string); + if (!pickle.ReadString(iter, &url_string)) { + LOG(ERROR) << "Failed to read url string"; + *url = GURL(); + return; + } *url = GURL(url_string); } diff --git a/chrome/browser/sync/util/nigori.cc b/chrome/browser/sync/util/nigori.cc index 49ed1db..51f767b 100644 --- a/chrome/browser/sync/util/nigori.cc +++ b/chrome/browser/sync/util/nigori.cc @@ -84,7 +84,8 @@ bool Nigori::InitByDerivation(const std::string& hostname, DCHECK(user_salt.get()); std::string raw_user_salt; - user_salt->GetRawKey(&raw_user_salt); + if (!user_salt->GetRawKey(&raw_user_salt)) + return false; // Kuser = PBKDF2(P, Suser, Nuser, 16) user_key_.reset(SymmetricKey::DeriveKeyFromPassword(SymmetricKey::AES, diff --git a/chrome/browser/task_manager/task_manager.cc b/chrome/browser/task_manager/task_manager.cc index ac58e034..d3e89a9 100644 --- a/chrome/browser/task_manager/task_manager.cc +++ b/chrome/browser/task_manager/task_manager.cc @@ -888,9 +888,12 @@ void TaskManagerModel::OnJobRedirect(net::URLRequestJob* job, void TaskManagerModel::OnBytesRead(net::URLRequestJob* job, const char* buf, int byte_count) { int render_process_host_child_id = -1, routing_id = -1; - ResourceDispatcherHost::RenderViewForRequest(job->request(), + if (!ResourceDispatcherHost::RenderViewForRequest(job->request(), &render_process_host_child_id, - &routing_id); + &routing_id)) { + NOTREACHED(); + } + // This happens in the IO thread, post it to the UI thread. int origin_child_id = chrome_browser_net::GetOriginProcessUniqueIDForRequest(job->request()); diff --git a/chrome/browser/visitedlink/visitedlink_master.cc b/chrome/browser/visitedlink/visitedlink_master.cc index e4b8444..0c7b923 100644 --- a/chrome/browser/visitedlink/visitedlink_master.cc +++ b/chrome/browser/visitedlink/visitedlink_master.cc @@ -950,7 +950,8 @@ bool VisitedLinkMaster::ReadFromFile(FILE* file, DCHECK(!posted_asynchronous_operation_); #endif - fseek(file, offset, SEEK_SET); + if (fseek(file, offset, SEEK_SET) != 0) + return false; size_t num_read = fread(data, 1, data_size, file); return num_read == data_size; diff --git a/chrome/browser/zygote_main_linux.cc b/chrome/browser/zygote_main_linux.cc index 7199e14..bf430e3 100644 --- a/chrome/browser/zygote_main_linux.cc +++ b/chrome/browser/zygote_main_linux.cc @@ -322,8 +322,10 @@ class Zygote { } error: - if (pid > 0) - waitpid(pid, NULL, WNOHANG); + if (pid > 0) { + if (waitpid(pid, NULL, WNOHANG) == -1) + LOG(ERROR) << "Failed to wait for process"; + } if (dummy_fd >= 0) close(dummy_fd); if (pipe_fds[0] >= 0) |