tainted<T_Rhs, T_Sbx> taintedVal = rhs; auto raw = reinterpret_cast<T_Lhs>(taintedVal.INTERNAL_unverified_safe()); auto ret = tainted<T_Lhs, T_Sbx>::internal_factory(raw); return ret;
}
tainted<T_Rhs, T_Sbx> taintedVal = rhs; auto raw = const_cast<T_Lhs>(taintedVal.INTERNAL_unverified_safe()); auto ret = tainted<T_Lhs, T_Sbx>::internal_factory(raw); return ret;
}
tainted<T_Rhs, T_Sbx> taintedVal = rhs; auto raw = static_cast<T_Lhs>(taintedVal.INTERNAL_unverified_safe()); auto ret = tainted<T_Lhs, T_Sbx>::internal_factory(raw); return ret;
}
static_assert(detail::rlbox_is_tainted_or_vol_v<T_Wrap<T_Rhs, T_Sbx>>, "memset called on non wrapped type");
static_assert(!std::is_const_v<T_Rhs>, "Destination is const");
auto num_val = detail::unwrap_value(num);
detail::dynamic_check(num_val <= sandbox.get_total_memory(), "Called memset for memory larger than the sandbox");
static_assert(detail::rlbox_is_tainted_or_vol_v<T_Wrap<T_Rhs, T_Sbx>>, "memcpy called on non wrapped type");
static_assert(!std::is_const_v<T_Rhs>, "Destination is const");
auto num_val = detail::unwrap_value(num);
detail::dynamic_check(num_val <= sandbox.get_total_memory(), "Called memcpy for memory larger than the sandbox");
// src may or may not be a wrapper, so use unwrap_value constvoid* src_start = detail::unwrap_value(src);
// if src is also a tainted/tainted-volatile pointer apply the same check if constexpr(detail::rlbox_is_tainted_or_vol_v<T_Lhs>) {
detail::check_range_doesnt_cross_app_sbx_boundary<T_Sbx>(src_start, num_val);
}
auto num_val = detail::unwrap_value(num);
detail::dynamic_check(num_val <= sandbox.get_total_memory(), "Called memcmp for memory larger than the sandbox");
// src may or may not be a wrapper, so use unwrap_value constvoid* src_start = detail::unwrap_value(src);
// if src is also a tainted/tainted-volatile pointer apply the same check if constexpr(detail::rlbox_is_tainted_or_vol_v<T_Lhs>) {
detail::check_range_doesnt_cross_app_sbx_boundary<T_Sbx>(src_start, num_val);
}
int ret = std::memcmp(dest_start, src_start, num_val);
tainted_int_hint converted_ret(ret); return converted_ret;
}
// This function is meant for byte buffers only
static_assert(can_type_be_memcopied<std::remove_pointer_t<T>>, "copy_memory_or_grant_access not supported on this type as " "there may be ABI differences");
static_assert(!detail::rlbox_is_tainted_or_vol_v<T>, "copy_memory_or_grant_access called on tainted type. Tainted " "data is already accessible to the sandbox. ");
// overflow ok
size_t source_size = num * sizeof(T);
// sandbox can grant access if it includes the following line // using can_grant_deny_access = void; if constexpr (detail::has_member_using_can_grant_deny_access_v<T_Sbx>) {
detail::check_range_doesnt_cross_app_sbx_boundary<T_Sbx>(src, source_size);
bool success; auto ret = sandbox.INTERNAL_grant_access(src, num, success); if (success) { return ret;
}
}
// Malloc in sandbox takes a uint32_t as the parameter, need a bounds check
detail::dynamic_check(num <= std::numeric_limits<uint32_t>::max(), "Granting access too large a region");
using T_nocv = std::remove_cv_t<T>;
tainted<T_nocv*, T_Sbx> copy =
sandbox.template malloc_in_sandbox<T_nocv>(static_cast<uint32_t>(num)); if (!copy) { return nullptr;
}
rlbox::memcpy(sandbox, copy, src, source_size); if (free_source_on_copy) {
free(const_cast<void*>(reinterpret_cast<constvoid*>(src)));
}
// This function is meant for byte buffers only - so char and char16
static_assert(can_type_be_memcopied<std::remove_pointer_t<T>>, "copy_memory_or_deny_access not supported on this type as " "there may be ABI differences");
// overflow ok
size_t source_size = num * sizeof(T);
// sandbox can grant access if it includes the following line // using can_grant_deny_access = void; if constexpr (detail::has_member_using_can_grant_deny_access_v<T_Sbx>) {
detail::check_range_doesnt_cross_app_sbx_boundary<T_Sbx>(
src.INTERNAL_unverified_safe(), source_size);
bool success; auto ret = sandbox.INTERNAL_deny_access(src, num, success); if (success) { return ret;
}
}
auto copy = static_cast<T*>(malloc(source_size)); if (!copy) { return nullptr;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.