2121#include " absl/strings/str_format.h"
2222#include " absl/strings/string_view.h"
2323#include " absl/types/span.h"
24- #include " quiche/common/platform/api/quiche_flag_utils.h"
2524#include " quiche/common/platform/api/quiche_logging.h"
2625
2726namespace quiche {
@@ -43,9 +42,6 @@ constexpr char kKeyChars09[] = DIGIT LCALPHA "_-";
4342constexpr char kKeyChars [] = DIGIT LCALPHA " _-.*" ;
4443constexpr char kSP [] = " " ;
4544constexpr char kOWS [] = " \t " ;
46- // https://www.rfc-editor.org/rfc/rfc8941.html#section-4.2.7
47- // https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-header-structure-09#section-4.2.11
48- constexpr char kBase64Chars [] = DIGIT UCALPHA LCALPHA " +/=" ;
4945#undef DIGIT
5046#undef LCALPHA
5147#undef UCALPHA
@@ -471,21 +467,7 @@ class StructuredHeaderParser {
471467 QUICHE_DVLOG (1 ) << " ReadByteSequence: missing closing delimiter" ;
472468 return std::nullopt ;
473469 }
474-
475- absl::string_view unpadded = input_.substr (0 , len);
476- // This check is partially redundant with the call to
477- // `absl::Base64Unescape()` below, but unfortunately that function
478- // allows `.` as a padding byte and does not reject ASCII whitespace, so it
479- // cannot be used in isolation.
480- if (unpadded.find_first_not_of (kBase64Chars ) != absl::string_view::npos) {
481- QUICHE_CODE_COUNT (structured_header_invalid_base64_char);
482- // TODO(b/393153699, b/393408763): Early-return here to reject the invalid
483- // input instead of silently proceeding.
484- }
485-
486- // TODO: This string copy shouldn't be necessary, as
487- // `absl::Base64Unescape()` already handles the absence of padding.
488- std::string base64 (unpadded);
470+ std::string base64 (input_.substr (0 , len));
489471 // Append the necessary padding characters.
490472 base64.resize ((base64.size () + 3 ) / 4 * 4 , ' =' );
491473
0 commit comments