sockaddr resolver: skip empty addresses in target URI (#28695)

* Adding constraints to the number of parsed targets in a specified URI to prevent OOMs

* removing hard limit on number of addresses in target uri
pull/28719/head
Vignesh Babu 3 years ago committed by GitHub
parent a1d48e7e31
commit ff0ecd2ff4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc
  2. 33
      test/core/end2end/fuzzers/api_fuzzer_corpus/testcase-5560572032974848

@ -91,6 +91,10 @@ bool ParseUri(const URI& uri,
// Construct addresses.
bool errors_found = false;
for (absl::string_view ith_path : absl::StrSplit(uri.path(), ',')) {
if (ith_path.empty()) {
// Skip targets which are empty.
continue;
}
auto ith_uri = URI::Create(uri.scheme(), "", std::string(ith_path), {}, "");
grpc_resolved_address addr;
if (!ith_uri.ok() || !parse(*ith_uri, &addr)) {

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save