Skip to content

Commit

Permalink
Fix a use-after-free bug in xls/visualization/sched_printer_main.cc.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 681567169
  • Loading branch information
XLS Team authored and copybara-github committed Oct 2, 2024
1 parent c82c620 commit e827137
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions xls/visualization/sched_printer_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,10 @@ absl::Status RealMain(std::string_view ir_path) {
XLS_RETURN_IF_ERROR(VerifyPackage(p.get()));

std::string top_str = absl::GetFlag(FLAGS_top);
std::optional<std::string_view> maybe_top_str =
top_str.empty() ? std::nullopt : std::make_optional(top_str);
std::optional<std::string_view> maybe_top_str;
if (!top_str.empty()) {
maybe_top_str = top_str;
}
XLS_ASSIGN_OR_RETURN(FunctionBase * main, FindTop(p.get(), maybe_top_str));

XLS_ASSIGN_OR_RETURN(
Expand Down

0 comments on commit e827137

Please sign in to comment.