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

Unified Diff: net/cert/internal/parsed_certificate.h

Issue 2331323005: Harden an API that takes base::StringPiece to give a compile error if (Closed)
Patch Set: Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/internal/parsed_certificate.h
diff --git a/net/cert/internal/parsed_certificate.h b/net/cert/internal/parsed_certificate.h
index fec9b6283eae4ebe254276bf2ecd6fe2ed85b75f..0b7c89ff51dc40cc0ea67414610e25665318511d 100644
--- a/net/cert/internal/parsed_certificate.h
+++ b/net/cert/internal/parsed_certificate.h
@@ -227,6 +227,24 @@ class NET_EXPORT ParsedCertificate
const ParseCertificateOptions& options,
CertErrors* errors);
+ // These private overloads should not be used, and have no definition.
+ //
+ // They are here to prevent incorrectly passing a const char*
+ // in place of a base::StringPiece (thanks to StringPiece implicit
+ // ctor on const char*).
+ //
+ // Accidentally inflating a const char* (without length) to a
+ // StringPiece would be a bug.
+ static scoped_refptr<ParsedCertificate> Create(
+ const char* invalid_data,
+ const ParseCertificateOptions& options,
+ CertErrors* errors);
+ static bool CreateAndAddToVector(
+ const char* data,
+ const ParseCertificateOptions& options,
+ std::vector<scoped_refptr<net::ParsedCertificate>>* chain,
+ CertErrors* errors);
+
// The backing store for the certificate data. This is only applicable when
// the ParsedCertificate was initialized using DataSource::INTERNAL_COPY.
std::vector<uint8_t> cert_data_;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698