The isHostname function could cause an unknown_error if regex parsing failed
This commit is contained in:
parent
9d5deeb830
commit
0e0605246f
|
@ -35,7 +35,12 @@ const static std::regex ipv4Validation("^([\\d]{1,3}\\.?){4,}:([\\d]+){1,}(:tls)
|
|||
} // anonymous namespace
|
||||
|
||||
bool Hostname::isHostname(const std::string& str) {
|
||||
return !std::regex_match(str, ipv4Validation) && std::regex_match(str, validation);
|
||||
try {
|
||||
return !std::regex_match(str, ipv4Validation) && std::regex_match(str, validation);
|
||||
} catch (std::exception e) {
|
||||
TraceEvent(SevWarn, "AddressParseError").detail("StdException", e.what()).detail("String", str);
|
||||
throw address_parse_error();
|
||||
}
|
||||
}
|
||||
|
||||
Hostname Hostname::parse(const std::string& s) {
|
||||
|
|
|
@ -220,7 +220,8 @@ ERROR( invalid_checkpoint_format, 2044, "Invalid checkpoint format" )
|
|||
ERROR( invalid_throttle_quota_value, 2045, "Invalid quota value. Note that reserved_throughput cannot exceed total_throughput" )
|
||||
ERROR( failed_to_create_checkpoint, 2046, "Failed to create a checkpoint" )
|
||||
ERROR( failed_to_restore_checkpoint, 2047, "Failed to restore a checkpoint" )
|
||||
ERROR( failed_to_create_checkpoint_shard_metadata, 2048, "Failed to dump shard metadata for a checkpoint to a sst file")
|
||||
ERROR( failed_to_create_checkpoint_shard_metadata, 2048, "Failed to dump shard metadata for a checkpoint to a sst file" )
|
||||
ERROR( address_parse_error, 2049, "Failed to parse address" )
|
||||
|
||||
ERROR( incompatible_protocol_version, 2100, "Incompatible protocol version" )
|
||||
ERROR( transaction_too_large, 2101, "Transaction exceeds byte limit" )
|
||||
|
|
Loading…
Reference in New Issue