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 7a91282

Browse filesBrowse files
0hmXaduh95
authored andcommitted
src: use simdjson::pad
PR-URL: #59391 Refs: #59389 Reviewed-By: Daniel Lemire <daniel@lemire.me> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 2237142 commit 7a91282
Copy full SHA for 7a91282

File tree

Expand file treeCollapse file tree

1 file changed

+2
-14
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-14
lines changed
Open diff view settings
Collapse file

‎src/node_modules.cc‎

Copy file name to clipboardExpand all lines: src/node_modules.cc
+2-14Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,23 +102,11 @@ const BindingData::PackageConfig* BindingData::GetPackageJSON(
102102
if (ReadFileSync(&package_config.raw_json, path.data()) < 0) {
103103
return nullptr;
104104
}
105-
// In some systems, std::string is annotated to generate an
106-
// AddressSanitizer: container-overflow error when reading beyond the end of
107-
// the string even when we are still within the capacity of the string.
108-
// https://github.com/google/sanitizers/wiki/AddressSanitizerContainerOverflow
109-
// https://github.com/nodejs/node/issues/55584
110-
// The next lines are a workaround to avoid this false positive.
111-
size_t json_length = package_config.raw_json.size();
112-
package_config.raw_json.append(simdjson::SIMDJSON_PADDING, ' ');
113-
simdjson::padded_string_view json_view(package_config.raw_json.data(),
114-
json_length,
115-
package_config.raw_json.size());
116-
// End of workaround
117-
118105
simdjson::ondemand::document document;
119106
simdjson::ondemand::object main_object;
120107
simdjson::error_code error =
121-
binding_data->json_parser.iterate(json_view).get(document);
108+
binding_data->json_parser.iterate(simdjson::pad(package_config.raw_json))
109+
.get(document);
122110

123111
const auto throw_invalid_package_config = [error_context, path, realm]() {
124112
if (error_context == nullptr) {

0 commit comments

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