Skip to content

Commit

Permalink
[Base] Fix Semaphore::Create invalid parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelLinn authored and gibbed committed Mar 8, 2022
1 parent bb42829 commit e75e0eb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/xenia/base/threading_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,10 @@ class PosixSemaphore : public PosixConditionHandle<Semaphore> {

std::unique_ptr<Semaphore> 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<PosixSemaphore>(initial_count, maximum_count);
}

Expand Down

0 comments on commit e75e0eb

Please sign in to comment.