Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Juanjo Alvarez <[email protected]>
  • Loading branch information
juanjux committed Sep 2, 2024
1 parent 8bcd3f1 commit 5c86c37
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ddtrace/appsec/_iast/_taint_tracking/Aspects/AspectSplit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,24 @@ split_text_common(const py::object& orig_function,

const auto& text = args_tuple[0];

const py::tuple sliced_args = len(args) > 1 ? args[py::slice(1, len(args), 1)] : py::tuple();
auto result_o = text.attr(split_func.c_str())(*sliced_args, **kwargs);
const py::tuple sliced_args = len(args) > 1 ? args[py::slice(1, len(args), 1)] : py::tuple(); // (,)
auto result_o = text.attr(split_func.c_str())(*sliced_args, **kwargs); // returns['', ''] WHY?

const auto tx_map = Initializer::get_tainting_map();
if (!tx_map || tx_map->empty()) {
return result_o;
}

TRY_CATCH_ASPECT("split_aspect", {
TRY_CATCH_ASPECT("split_aspect", , {
if (split_func == "split") {
if (auto re_split_result = handle_potential_re_split(args_tuple, sliced_args, kwargs, tx_map);
re_split_result.has_value()) {
return *re_split_result;
}
}

if (const auto ranges = api_get_ranges(text); !ranges.empty()) {
auto [ranges, ranges_error] = get_ranges(text.ptr(), tx_map);
if (!ranges_error and !ranges.empty()) {
set_ranges_on_splitted(text, ranges, result_o, tx_map, false);
}
});
Expand Down

0 comments on commit 5c86c37

Please sign in to comment.