Index: chrome/utility/importer/nss_decryptor.cc |
diff --git a/chrome/utility/importer/nss_decryptor.cc b/chrome/utility/importer/nss_decryptor.cc |
index 77a10a0bc044d1901b9f260cb9b980c81d9bc1fa..656b73ff8443a4e76c59c3ade82c62b67c7f879d 100644 |
--- a/chrome/utility/importer/nss_decryptor.cc |
+++ b/chrome/utility/importer/nss_decryptor.cc |
@@ -66,12 +66,16 @@ base::string16 NSSDecryptor::Decrypt(const std::string& crypt) const { |
if (!is_nss_initialized_) |
return base::string16(); |
+ if (crypt.empty()) |
+ return base::string16(); |
+ |
// The old style password is encoded in base64. They are identified |
// by a leading '~'. Otherwise, we should decrypt the text. |
std::string plain; |
if (crypt[0] != '~') { |
std::string decoded_data; |
- base::Base64Decode(crypt, &decoded_data); |
+ if (!base::Base64Decode(crypt, &decoded_data)) |
+ return base::string16(); |
PK11SlotInfo* slot = GetKeySlotForDB(); |
SECStatus result = PK11_Authenticate(slot, PR_TRUE, NULL); |
if (result != SECSuccess) { |
@@ -98,7 +102,8 @@ base::string16 NSSDecryptor::Decrypt(const std::string& crypt) const { |
FreeSlot(slot); |
} else { |
// Deletes the leading '~' before decoding. |
- base::Base64Decode(crypt.substr(1), &plain); |
+ if (!base::Base64Decode(crypt.substr(1), &plain)) |
+ return base::string16(); |
} |
return base::UTF8ToUTF16(plain); |