From 9e6b136d8399acdfaa74d31773f93ce7361726f9 Mon Sep 17 00:00:00 2001 From: bridiver Date: Tue, 11 Dec 2018 16:27:35 -0700 Subject: [PATCH] guard against invalid urls from bat-native-ads notifications fix https://github.com/brave/brave-browser/issues/2472 --- DEPS | 2 +- components/brave_ads/browser/ads_service_impl.cc | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 9e3dd61aa732..4931cf2ee686 100644 --- a/DEPS +++ b/DEPS @@ -17,7 +17,7 @@ deps = { "vendor/bat-native-tweetnacl": "https://github.com/brave-intl/bat-native-tweetnacl.git@1b4362968c8f22720bfb75af6f506d4ecc0f3116", "components/brave_sync/extension/brave-sync": "https://github.com/brave/sync.git@d926cfb84e3f644ab14d0908608025c19c753f4b", "components/brave_sync/extension/brave-crypto": "https://github.com/brave/crypto@7e391cec6975106fa9f686016f494cb8a782afcd", - "vendor/bat-native-ads": "https://github.com/brave-intl/bat-native-ads.git@041b8b3b8635900b73607cba88d362e3356a3577", + "vendor/bat-native-ads": "https://github.com/brave-intl/bat-native-ads.git@ebad9519a0a6adaff38dce39475bf535da4ec10a", "vendor/bat-native-usermodel": "https://github.com/brave-intl/bat-native-usermodel.git@c3b6111aa862c5c452c84be8a225d5f1df32b284", } diff --git a/components/brave_ads/browser/ads_service_impl.cc b/components/brave_ads/browser/ads_service_impl.cc index 28568423785b..5b05d56f6842 100644 --- a/components/brave_ads/browser/ads_service_impl.cc +++ b/components/brave_ads/browser/ads_service_impl.cc @@ -733,6 +733,10 @@ void AdsServiceImpl::OpenSettings(Profile* profile, } GURL url(notification_info->url); + if (!url.is_valid()) { + LOG(WARNING) << "Invalid notification URL: " << notification_info->url; + return; + } #if defined(OS_ANDROID) NavigateParams nav_params(profile, url, ui::PAGE_TRANSITION_LINK);