diff --git a/.gitattributes b/.gitattributes index 74328c47613e95..dfb4ad17849f64 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,5 @@ # Stop Windows python license check presubmit errors by forcing LF checkout. *.py text eol=lf + +# Force LF checkout of the pins files to avoid transport_security_state_generator errors. +/net/http/*.pins text eol=lf diff --git a/net/tools/transport_security_state_generator/input_file_parsers.cc b/net/tools/transport_security_state_generator/input_file_parsers.cc index 2a8d3d80490e56..691b403281e50a 100644 --- a/net/tools/transport_security_state_generator/input_file_parsers.cc +++ b/net/tools/transport_security_state_generator/input_file_parsers.cc @@ -167,6 +167,12 @@ enum class CertificateParserState { } // namespace bool ParseCertificatesFile(base::StringPiece certs_input, Pinsets* pinsets) { + if (certs_input.find("\r\n") != base::StringPiece::npos) { + LOG(ERROR) << "CRLF line-endings found in the pins file. All files must " + "use LF (unix style) line-endings."; + return false; + } + std::string line; CertificateParserState current_state = CertificateParserState::PRE_NAME;