mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-06-11 16:28:24 +02:00
read-only mirror of https://gitlab.freedesktop.org/pipewire/wireplumber
These builders had many bugs: 1. They would longjmp() across the destructor of a g_autoptr() if a Lua error was thrown. This will leak the memory in the g_autoptr() unless Lua is compiled with C++ exceptions. 2. They depended on the iteration order of numerical keys in Lua tables. Lua explicitly does not specify this order. 3. They would produce nonsensical SPA POD array or choice types with strings or bytes as values. These would cause undefined behavior if manipulated by naive C code, or assertion failures if spa_pod_is_array() and spa_pod_is_choice() are modified to check that the contents of arrays and choices have sensible types. 4. They silently accepted extra arguments, potentially causing confusion and making it harder to extend the functions in a backwards-compatible way. Solve the first problem by calling functions that can raise a Lua error in a protected environment (with lua_pcall). If there is a Lua error, rethrow it after the g_autoptr() destructor has run. Solve the second problem by first obtaining the number of keys in the table and then iterating over the keys that are expected to be present. If any of the keys are not contiguious integers starting at 1, the range [1..number of keys] will include a number that is not a table key. This will result in lua_rawgeti pushing a nil onto the Lua stack. An explicit check throws a useful error in this case. Solve the third problem by explicitly checking that the type is reasonable before building an array or choice. If it is wrong, a Lua error is thrown. Solve the fourth problem by using luaL_checktype (L, 2, LUA_TNONE) to check that no unwanted values were passed. The C function called with lua_pcall is passed every argument passed by Lua, followed by a light userdata that stores a context pointer. After the light userdata is popped from the Lua stack, the Lua stack is identical to what Lua created when it called the outer C function, so the type-checking functions in the auxillary library can be used to enforce that only the correct number and type of arguments were passed. |
||
|---|---|---|
| docs | ||
| lib | ||
| modules | ||
| po | ||
| src | ||
| subprojects | ||
| tests | ||
| .editorconfig | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| LICENSE | ||
| Makefile | ||
| meson.build | ||
| meson_options.txt | ||
| NEWS.rst | ||
| README.rst | ||
| wp-uninstalled.sh | ||
WirePlumber =========== .. image:: https://gitlab.freedesktop.org/pipewire/wireplumber/badges/master/pipeline.svg :alt: Pipeline status .. image:: https://scan.coverity.com/projects/21488/badge.svg :alt: Coverity Scan Build Status .. image:: https://img.shields.io/badge/license-MIT-green :alt: License .. image:: https://img.shields.io/badge/dynamic/json?color=informational&label=tag&query=%24%5B0%5D.name&url=https%3A%2F%2Fgitlab.freedesktop.org%2Fapi%2Fv4%2Fprojects%2F2941%2Frepository%2Ftags :alt: Tag WirePlumber is a modular session / policy manager for `PipeWire <https://pipewire.org>`_ and a GObject-based high-level library that wraps PipeWire's API, providing convenience for writing the daemon's modules as well as external tools for managing PipeWire. The WirePlumber daemon implements the session & policy management service. It follows a modular design, having plugins that implement the actual management functionality. The WirePlumber Library provides API that allows you to extend the WirePlumber daemon, to write management or status tools for PipeWire (apps that don't do actual media streaming) and to write custom session managers for embedded devices. Documentation ------------- The latest version of the documentation is available online `here <https://pipewire.pages.freedesktop.org/wireplumber/>`_