Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3d2e23a

Browse filesBrowse files
nodejs-github-botaduh95
authored andcommitted
deps: update ada to 3.4.4
PR-URL: #62414 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
1 parent 176d6d2 commit 3d2e23a
Copy full SHA for 3d2e23a

2 files changed

+110-33Lines changed: 110 additions & 33 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎deps/ada/ada.cpp‎

Copy file name to clipboardExpand all lines: deps/ada/ada.cpp
+52-15Lines changed: 52 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* auto-generated on 2026-02-23 21:29:24 -0500. Do not edit! */
1+
/* auto-generated on 2026-03-23 17:52:13 -0400. Do not edit! */
22
/* begin file src/ada.cpp */
33
#include "ada.h"
44
/* begin file src/checkers.cpp */
@@ -10725,7 +10725,7 @@ constexpr static std::array<uint8_t, 256> is_forbidden_domain_code_point_table =
1072510725
for (uint8_t c = 0; c <= 32; c++) {
1072610726
result[c] = true;
1072710727
}
10728-
for (size_t c = 127; c < 255; c++) {
10728+
for (size_t c = 127; c < 256; c++) {
1072910729
result[c] = true;
1073010730
}
1073110731
return result;
@@ -10767,7 +10767,7 @@ constexpr static std::array<uint8_t, 256>
1076710767
for (uint8_t c = 0; c <= 32; c++) {
1076810768
result[c] = 1;
1076910769
}
10770-
for (size_t c = 127; c < 255; c++) {
10770+
for (size_t c = 127; c < 256; c++) {
1077110771
result[c] = 1;
1077210772
}
1077310773
return result;
@@ -13404,7 +13404,13 @@ result_type parse_url_impl(std::string_view user_input,
1340413404
url.query = base_url->query;
1340513405
} else {
1340613406
url.update_base_pathname(base_url->get_pathname());
13407-
url.update_base_search(base_url->get_search());
13407+
if (base_url->has_search()) {
13408+
// get_search() returns "" for an empty query string (URL ends
13409+
// with '?'). update_base_search("") would incorrectly clear the
13410+
// query, so pass "?" to preserve the empty query distinction.
13411+
auto s = base_url->get_search();
13412+
url.update_base_search(s.empty() ? std::string_view("?") : s);
13413+
}
1340813414
}
1340913415
url.update_unencoded_base_hash(*fragment);
1341013416
return url;
@@ -13628,7 +13634,13 @@ result_type parse_url_impl(std::string_view user_input,
1362813634
// cloning the base path includes cloning the has_opaque_path flag
1362913635
url.has_opaque_path = base_url->has_opaque_path;
1363013636
url.update_base_pathname(base_url->get_pathname());
13631-
url.update_base_search(base_url->get_search());
13637+
if (base_url->has_search()) {
13638+
// get_search() returns "" for an empty query string (URL ends
13639+
// with '?'). update_base_search("") would incorrectly clear the
13640+
// query, so pass "?" to preserve the empty query distinction.
13641+
auto s = base_url->get_search();
13642+
url.update_base_search(s.empty() ? std::string_view("?") : s);
13643+
}
1363213644
}
1363313645

1363413646
url.has_opaque_path = base_url->has_opaque_path;
@@ -14046,7 +14058,13 @@ result_type parse_url_impl(std::string_view user_input,
1404614058
} else {
1404714059
url.update_host_to_base_host(base_url->get_hostname());
1404814060
url.update_base_pathname(base_url->get_pathname());
14049-
url.update_base_search(base_url->get_search());
14061+
if (base_url->has_search()) {
14062+
// get_search() returns "" for an empty query string (URL ends
14063+
// with '?'). update_base_search("") would incorrectly clear the
14064+
// query, so pass "?" to preserve the empty query distinction.
14065+
auto s = base_url->get_search();
14066+
url.update_base_search(s.empty() ? std::string_view("?") : s);
14067+
}
1405014068
}
1405114069
url.has_opaque_path = base_url->has_opaque_path;
1405214070

@@ -16657,8 +16675,15 @@ tl::expected<std::string, errors> canonicalize_pathname(
1665716675
const auto pathname = url->get_pathname();
1665816676
// If leading slash is false, then set result to the code point substring
1665916677
// from 2 to the end of the string within result.
16660-
return leading_slash ? std::string(pathname)
16661-
: std::string(pathname.substr(2));
16678+
if (!leading_slash) {
16679+
// pathname should start with "/-" but path traversal (e.g. "../../")
16680+
// can reduce it to just "/" which is shorter than 2 characters.
16681+
if (pathname.size() < 2) {
16682+
return tl::unexpected(errors::type_error);
16683+
}
16684+
return std::string(pathname.substr(2));
16685+
}
16686+
return std::string(pathname);
1666216687
}
1666316688
// If parseResult is failure, then throw a TypeError.
1666416689
return tl::unexpected(errors::type_error);
@@ -17195,7 +17220,8 @@ std::string generate_pattern_string(
1719517220
// point.
1719617221
bool needs_grouping =
1719717222
!part.suffix.empty() ||
17198-
(!part.prefix.empty() && part.prefix[0] != options.get_prefix()[0]);
17223+
(!part.prefix.empty() && !options.get_prefix().empty() &&
17224+
part.prefix[0] != options.get_prefix()[0]);
1719917225

1720017226
// If all of the following are true:
1720117227
// - needs grouping is false; and
@@ -17233,9 +17259,8 @@ std::string generate_pattern_string(
1723317259
// then set needs grouping to true.
1723417260
if (!needs_grouping && part.prefix.empty() && previous_part &&
1723517261
previous_part->type == url_pattern_part_type::FIXED_TEXT &&
17236-
!options.get_prefix().empty() &&
17237-
previous_part->value.at(previous_part->value.size() - 1) ==
17238-
options.get_prefix()[0]) {
17262+
!previous_part->value.empty() && !options.get_prefix().empty() &&
17263+
previous_part->value.back() == options.get_prefix()[0]) {
1723917264
needs_grouping = true;
1724017265
}
1724117266

@@ -17358,8 +17383,14 @@ std_regex_provider::regex_search(std::string_view input,
1735817383
const std::regex& pattern) {
1735917384
// Use iterator-based regex_search to avoid string allocation
1736017385
std::match_results<std::string_view::const_iterator> match_result;
17361-
if (!std::regex_search(input.begin(), input.end(), match_result, pattern,
17362-
std::regex_constants::match_any)) {
17386+
try {
17387+
if (!std::regex_search(input.begin(), input.end(), match_result, pattern,
17388+
std::regex_constants::match_any)) {
17389+
return std::nullopt;
17390+
}
17391+
} catch (const std::regex_error& e) {
17392+
(void)e;
17393+
ada_log("std_regex_provider::regex_search failed:", e.what());
1736317394
return std::nullopt;
1736417395
}
1736517396
std::vector<std::optional<std::string>> matches;
@@ -17378,7 +17409,13 @@ std_regex_provider::regex_search(std::string_view input,
1737817409

1737917410
bool std_regex_provider::regex_match(std::string_view input,
1738017411
const std::regex& pattern) {
17381-
return std::regex_match(input.begin(), input.end(), pattern);
17412+
try {
17413+
return std::regex_match(input.begin(), input.end(), pattern);
17414+
} catch (const std::regex_error& e) {
17415+
(void)e;
17416+
ada_log("std_regex_provider::regex_match failed:", e.what());
17417+
return false;
17418+
}
1738217419
}
1738317420

1738417421
#endif // ADA_USE_UNSAFE_STD_REGEX_PROVIDER
Collapse file

‎deps/ada/ada.h‎

Copy file name to clipboardExpand all lines: deps/ada/ada.h
+58-18Lines changed: 58 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* auto-generated on 2026-02-23 21:29:24 -0500. Do not edit! */
1+
/* auto-generated on 2026-03-23 17:52:13 -0400. Do not edit! */
22
/* begin file include/ada.h */
33
/**
44
* @file ada.h
@@ -6458,6 +6458,39 @@ constexpr std::string_view is_special_list[] = {"http", " ", "https", "ws",
64586458
"ftp", "wss", "file", " "};
64596459
// for use with get_special_port
64606460
constexpr uint16_t special_ports[] = {80, 0, 443, 80, 21, 443, 0, 0};
6461+
6462+
// @private
6463+
// convert a string_view to a 64-bit integer key for fast comparison
6464+
constexpr uint64_t make_key(std::string_view sv) {
6465+
uint64_t val = 0;
6466+
for (size_t i = 0; i < sv.size(); i++)
6467+
val |= (uint64_t)(uint8_t)sv[i] << (i * 8);
6468+
return val;
6469+
}
6470+
// precomputed keys for the special schemes, indexed by a hash of the input
6471+
// string
6472+
constexpr uint64_t scheme_keys[] = {
6473+
make_key("http"), // 0: HTTP
6474+
0, // 1: sentinel
6475+
make_key("https"), // 2: HTTPS
6476+
make_key("ws"), // 3: WS
6477+
make_key("ftp"), // 4: FTP
6478+
make_key("wss"), // 5: WSS
6479+
make_key("file"), // 6: FILE
6480+
0, // 7: sentinel
6481+
};
6482+
6483+
// @private
6484+
// branchless load of up to 5 characters into a uint64_t, padding with zeros if
6485+
// n < 5
6486+
inline uint64_t branchless_load5(const char *p, size_t n) {
6487+
uint64_t input = (uint8_t)p[0];
6488+
input |= ((uint64_t)(uint8_t)p[n > 1] << 8) & (0 - (uint64_t)(n > 1));
6489+
input |= ((uint64_t)(uint8_t)p[(n > 2) * 2] << 16) & (0 - (uint64_t)(n > 2));
6490+
input |= ((uint64_t)(uint8_t)p[(n > 3) * 3] << 24) & (0 - (uint64_t)(n > 3));
6491+
input |= ((uint64_t)(uint8_t)p[(n > 4) * 4] << 32) & (0 - (uint64_t)(n > 4));
6492+
return input;
6493+
}
64616494
} // namespace details
64626495

64636496
/****
@@ -6498,7 +6531,9 @@ constexpr uint16_t get_special_port(std::string_view scheme) noexcept {
64986531
}
64996532
int hash_value = (2 * scheme.size() + (unsigned)(scheme[0])) & 7;
65006533
const std::string_view target = details::is_special_list[hash_value];
6501-
if ((target[0] == scheme[0]) && (target.substr(1) == scheme.substr(1))) {
6534+
if (scheme.size() == target.size() &&
6535+
details::branchless_load5(scheme.data(), scheme.size()) ==
6536+
details::scheme_keys[hash_value]) {
65026537
return details::special_ports[hash_value];
65036538
} else {
65046539
return 0;
@@ -6513,7 +6548,9 @@ constexpr ada::scheme::type get_scheme_type(std::string_view scheme) noexcept {
65136548
}
65146549
int hash_value = (2 * scheme.size() + (unsigned)(scheme[0])) & 7;
65156550
const std::string_view target = details::is_special_list[hash_value];
6516-
if ((target[0] == scheme[0]) && (target.substr(1) == scheme.substr(1))) {
6551+
if (scheme.size() == target.size() &&
6552+
details::branchless_load5(scheme.data(), scheme.size()) ==
6553+
details::scheme_keys[hash_value]) {
65176554
return ada::scheme::type(hash_value);
65186555
} else {
65196556
return ada::scheme::NOT_SPECIAL;
@@ -9368,7 +9405,8 @@ inline void url_search_params::remove(const std::string_view key,
93689405
}
93699406

93709407
inline void url_search_params::sort() {
9371-
// We rely on the fact that the content is valid UTF-8.
9408+
// Keys are expected to be valid UTF-8, but percent_decode can produce
9409+
// arbitrary byte sequences. Handle truncated/invalid sequences gracefully.
93729410
std::ranges::stable_sort(params, [](const key_value_pair &lhs,
93739411
const key_value_pair &rhs) {
93749412
size_t i = 0, j = 0;
@@ -9382,18 +9420,15 @@ inline void url_search_params::sort() {
93829420
low_surrogate1 = 0;
93839421
} else {
93849422
uint8_t c1 = uint8_t(lhs.first[i]);
9385-
if (c1 <= 0x7F) {
9386-
codePoint1 = c1;
9387-
i++;
9388-
} else if (c1 <= 0xDF) {
9423+
if (c1 > 0x7F && c1 <= 0xDF && i + 1 < lhs.first.size()) {
93899424
codePoint1 = ((c1 & 0x1F) << 6) | (uint8_t(lhs.first[i + 1]) & 0x3F);
93909425
i += 2;
9391-
} else if (c1 <= 0xEF) {
9426+
} else if (c1 > 0xDF && c1 <= 0xEF && i + 2 < lhs.first.size()) {
93929427
codePoint1 = ((c1 & 0x0F) << 12) |
93939428
((uint8_t(lhs.first[i + 1]) & 0x3F) << 6) |
93949429
(uint8_t(lhs.first[i + 2]) & 0x3F);
93959430
i += 3;
9396-
} else {
9431+
} else if (c1 > 0xEF && c1 <= 0xF7 && i + 3 < lhs.first.size()) {
93979432
codePoint1 = ((c1 & 0x07) << 18) |
93989433
((uint8_t(lhs.first[i + 1]) & 0x3F) << 12) |
93999434
((uint8_t(lhs.first[i + 2]) & 0x3F) << 6) |
@@ -9404,6 +9439,10 @@ inline void url_search_params::sort() {
94049439
uint16_t high_surrogate = uint16_t(0xD800 + (codePoint1 >> 10));
94059440
low_surrogate1 = uint16_t(0xDC00 + (codePoint1 & 0x3FF));
94069441
codePoint1 = high_surrogate;
9442+
} else {
9443+
// ASCII (c1 <= 0x7F) or truncated/invalid UTF-8: treat as raw byte
9444+
codePoint1 = c1;
9445+
i++;
94079446
}
94089447
}
94099448

@@ -9412,18 +9451,15 @@ inline void url_search_params::sort() {
94129451
low_surrogate2 = 0;
94139452
} else {
94149453
uint8_t c2 = uint8_t(rhs.first[j]);
9415-
if (c2 <= 0x7F) {
9416-
codePoint2 = c2;
9417-
j++;
9418-
} else if (c2 <= 0xDF) {
9454+
if (c2 > 0x7F && c2 <= 0xDF && j + 1 < rhs.first.size()) {
94199455
codePoint2 = ((c2 & 0x1F) << 6) | (uint8_t(rhs.first[j + 1]) & 0x3F);
94209456
j += 2;
9421-
} else if (c2 <= 0xEF) {
9457+
} else if (c2 > 0xDF && c2 <= 0xEF && j + 2 < rhs.first.size()) {
94229458
codePoint2 = ((c2 & 0x0F) << 12) |
94239459
((uint8_t(rhs.first[j + 1]) & 0x3F) << 6) |
94249460
(uint8_t(rhs.first[j + 2]) & 0x3F);
94259461
j += 3;
9426-
} else {
9462+
} else if (c2 > 0xEF && c2 <= 0xF7 && j + 3 < rhs.first.size()) {
94279463
codePoint2 = ((c2 & 0x07) << 18) |
94289464
((uint8_t(rhs.first[j + 1]) & 0x3F) << 12) |
94299465
((uint8_t(rhs.first[j + 2]) & 0x3F) << 6) |
@@ -9433,6 +9469,10 @@ inline void url_search_params::sort() {
94339469
uint16_t high_surrogate = uint16_t(0xD800 + (codePoint2 >> 10));
94349470
low_surrogate2 = uint16_t(0xDC00 + (codePoint2 & 0x3FF));
94359471
codePoint2 = high_surrogate;
9472+
} else {
9473+
// ASCII (c2 <= 0x7F) or truncated/invalid UTF-8: treat as raw byte
9474+
codePoint2 = c2;
9475+
j++;
94369476
}
94379477
}
94389478

@@ -11228,14 +11268,14 @@ constructor_string_parser<regex_provider>::parse(std::string_view input) {
1122811268
#ifndef ADA_ADA_VERSION_H
1122911269
#define ADA_ADA_VERSION_H
1123011270

11231-
#define ADA_VERSION "3.4.3"
11271+
#define ADA_VERSION "3.4.4"
1123211272

1123311273
namespace ada {
1123411274

1123511275
enum {
1123611276
ADA_VERSION_MAJOR = 3,
1123711277
ADA_VERSION_MINOR = 4,
11238-
ADA_VERSION_REVISION = 3,
11278+
ADA_VERSION_REVISION = 4,
1123911279
};
1124011280

1124111281
} // namespace ada

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.