Skip to content

Commit

Permalink
feature: throwing an invalid_stride error when the size provided to w…
Browse files Browse the repository at this point in the history
…l_shm::create_pool is less than or equal to zero
  • Loading branch information
mattkae committed Nov 18, 2024
1 parent a9cddcb commit b5407fd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/server/frontend_wayland/shm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,5 +332,13 @@ mf::Shm::Shm(wl_resource* resource, std::shared_ptr<Executor> wayland_executor)

void mf::Shm::create_pool(wl_resource* id, Fd fd, int32_t size)
{
if (size <= 0)
{
throw wayland::ProtocolError{
resource,
wayland::Shm::Error::invalid_stride,
"Invalid requested size"};
}

new ShmPool{id, wayland_executor, fd, size};
}

0 comments on commit b5407fd

Please sign in to comment.