Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request from GHSA-f6rp-gv58-9cw3
Browse files Browse the repository at this point in the history
  • Loading branch information
xzyfer authored Jan 16, 2020
1 parent c6f2e5a commit 338fd7a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/custom_importer_bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ SassImportList CustomImporterBridge::post_process_return_value(v8::Local<v8::Val
imports = sass_make_import_list(array->Length());

for (size_t i = 0; i < array->Length(); ++i) {
v8::Local<v8::Value> value = Nan::Get(array, static_cast<uint32_t>(i)).ToLocalChecked();
v8::Local<v8::Value> value;
Nan::MaybeLocal<v8::Value> unchecked = Nan::Get(array, static_cast<uint32_t>(i));

if (!value->IsObject()) {
auto entry = sass_make_import_entry(0, 0, 0);
sass_import_set_error(entry, "returned array must only contain object literals", -1, -1);
if (!unchecked.ToLocal(&value) || !value->IsObject()) {
imports[i] = sass_make_import_entry(0, 0, 0);
sass_import_set_error(imports[i], "returned array must only contain object literals", -1, -1);
continue;
}

Expand Down Expand Up @@ -71,9 +72,9 @@ Sass_Import* CustomImporterBridge::check_returned_string(Nan::MaybeLocal<v8::Val
}

Sass_Import* CustomImporterBridge::get_importer_entry(const v8::Local<v8::Object>& object) const {
auto returned_file = Nan::Get(object, Nan::New<v8::String>("file").ToLocalChecked());
auto returned_contents = Nan::Get(object, Nan::New<v8::String>("contents").ToLocalChecked()).ToLocalChecked();
auto returned_map = Nan::Get(object, Nan::New<v8::String>("map").ToLocalChecked());
Nan::MaybeLocal<v8::Value> returned_file = Nan::Get(object, Nan::New<v8::String>("file").ToLocalChecked());
Nan::MaybeLocal<v8::Value> returned_contents = Nan::Get(object, Nan::New<v8::String>("contents").ToLocalChecked());
Nan::MaybeLocal<v8::Value> returned_map = Nan::Get(object, Nan::New<v8::String>("map").ToLocalChecked());
Sass_Import *err;

if ((err = check_returned_string(returned_file, "returned value of `file` must be a string")))
Expand Down

0 comments on commit 338fd7a

Please sign in to comment.