Skip to content

pipewire: read a modifier choice at the right offset - #255

Merged
jcelerier merged 1 commit into
masterfrom
fix/pipewire-modifier-choice-parse
Sep 12, 2026
Merged

pipewire: read a modifier choice at the right offset#255
jcelerier merged 1 commit into
masterfrom
fix/pipewire-modifier-choice-parse

Conversation

@jcelerier

@jcelerier jcelerier commented Sep 11, 2026

Copy link
Copy Markdown
Member

extract_modifier_choice stepped past SPA_POD_CONTENTS(spa_pod_choice, ..) by another sizeof(spa_pod_choice_body). The macro already skips the pod header and the choice body, so it points at the first value; adding the body size again dropped the first two modifiers and read two entries past the end of the pod.

What the consumer gets back is then a list of neighbouring pod bytes. Fixating on one of those asks the producer to import the dma-buf with a modifier nobody offered, and vkAllocateMemory fails with VK_ERROR_OUT_OF_DEVICE_MEMORY on every frame, because the image that layout implies does not fit the buffer.

This uses SPA_POD_CHOICE_VALUES and SPA_POD_CHOICE_N_VALUES instead of stepping the pointer by hand, and ignores a choice whose values are not 8 bytes wide, since a modifier is a Long.

Found while debugging ossia score's PipeWire DMA-BUF video input, which rendered black on Vulkan for this reason. With the fix the modifier list parses correctly, the import succeeds and the input renders correct pixels.

🤖 Generated with Claude Code

https://claude.ai/code/session_019QWYTEhFJonuUNTEmBfv7Q

@jcelerier
jcelerier force-pushed the fix/pipewire-modifier-choice-parse branch from 3727779 to 7b401de Compare September 11, 2026 03:41
@jcelerier
jcelerier force-pushed the fix/pipewire-modifier-choice-parse branch from 7b401de to 3cee443 Compare September 11, 2026 03:59
jcelerier added a commit to ossia/libossia that referenced this pull request Sep 11, 2026
Picks up celtera/libremidi#255. extract_modifier_choice read a DMA-BUF
modifier list at the wrong offset, so a consumer fixated on a modifier the
producer never offered and every Vulkan import failed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019QWYTEhFJonuUNTEmBfv7Q
extract_modifier_choice stepped past SPA_POD_CONTENTS(spa_pod_choice, ..) by
another sizeof(spa_pod_choice_body). The macro already skips the pod header
and the choice body, so it points at the first value; adding the body size
again dropped the first two modifiers and read two entries past the end.

What a consumer gets back is then a list of neighbouring pod bytes. Fixating
on one of those asks the producer to import the dma-buf with a modifier nobody
offered, and vkAllocateMemory fails with VK_ERROR_OUT_OF_DEVICE_MEMORY on
every frame because the image that layout implies does not fit the buffer.

Use SPA_POD_CHOICE_VALUES and SPA_POD_CHOICE_N_VALUES instead, and ignore a
choice whose values are not 8 bytes wide, since a modifier is a Long.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019QWYTEhFJonuUNTEmBfv7Q
@jcelerier
jcelerier force-pushed the fix/pipewire-modifier-choice-parse branch from 3cee443 to 4822d1d Compare September 12, 2026 13:48
jcelerier added a commit to ossia/libossia that referenced this pull request Sep 12, 2026
Picks up celtera/libremidi#255. extract_modifier_choice read a DMA-BUF
modifier list at the wrong offset, so a consumer fixated on a modifier the
producer never offered and every Vulkan import failed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019QWYTEhFJonuUNTEmBfv7Q
@jcelerier
jcelerier merged commit cc5aa15 into master Sep 12, 2026
39 of 90 checks passed
@jcelerier
jcelerier deleted the fix/pipewire-modifier-choice-parse branch September 12, 2026 18:28
jcelerier added a commit to ossia/libossia that referenced this pull request Sep 12, 2026
Picks up celtera/libremidi#255. extract_modifier_choice read a DMA-BUF
modifier list at the wrong offset, so a consumer fixated on a modifier the
producer never offered and every Vulkan import failed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019QWYTEhFJonuUNTEmBfv7Q
jcelerier added a commit to ossia/score that referenced this pull request Sep 12, 2026
Picks up ossia/libossia#936, which pins celtera/libremidi#255. Without it
the DMA-BUF modifier reaching DRMPrimeDecoder is garbage and every Vulkan
import fails, so the video input renders black.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019QWYTEhFJonuUNTEmBfv7Q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant