Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 171297a7 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

Dumpsys: check input

fd should be positive number

Test: cert/run
Bug: 190535782
Tag: #stability
Change-Id: I723774041985a476ac6a6977a6124d3bead90cef
parent 813de98d
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -142,6 +142,9 @@ Dumpsys::Dumpsys(const std::string& pre_bundled_schema)
    : reflection_schema_(dumpsys::ReflectionSchema(pre_bundled_schema)) {}

void Dumpsys::Dump(int fd, const char** args) {
  if (fd <= 0) {
    return;
  }
  std::promise<void> promise;
  auto future = promise.get_future();
  CallOn(pimpl_.get(), &Dumpsys::impl::DumpWithArgsSync, fd, args, std::move(promise));
@@ -149,6 +152,10 @@ void Dumpsys::Dump(int fd, const char** args) {
}

void Dumpsys::Dump(int fd, const char** args, std::promise<void> promise) {
  if (fd <= 0) {
    promise.set_value();
    return;
  }
  CallOn(pimpl_.get(), &Dumpsys::impl::DumpWithArgsSync, fd, args, std::move(promise));
}