From e75e0eb39c1ac9a409f4c24533404652f08ef9a8 Mon Sep 17 00:00:00 2001 From: Joel Linn Date: Mon, 21 Feb 2022 23:02:38 +0100 Subject: [PATCH] [Base] Fix `Semaphore::Create` invalid parameters --- src/xenia/base/threading_posix.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/xenia/base/threading_posix.cc b/src/xenia/base/threading_posix.cc index 4e8fdfd51..fac86abc8 100644 --- a/src/xenia/base/threading_posix.cc +++ b/src/xenia/base/threading_posix.cc @@ -975,6 +975,10 @@ class PosixSemaphore : public PosixConditionHandle { std::unique_ptr Semaphore::Create(int initial_count, int maximum_count) { + if (initial_count < 0 || initial_count > maximum_count || + maximum_count <= 0) { + return nullptr; + } return std::make_unique(initial_count, maximum_count); }