[pulseaudio-discuss] [PATCH 3/3] protocol-native: Fail if trying to push unaligned memblock into queue

Arun Raghavan arun at accosted.net
Fri Oct 24 04:26:41 PDT 2014


On 20 October 2014 16:52, David Henningsson
<david.henningsson at canonical.com> wrote:
>
>
> On 2014-10-17 12:06, Arun Raghavan wrote:
>>
>> On Thu, 2014-10-16 at 11:41 +0200, David Henningsson wrote:
>>>
>>> We will just ignore the memblock if this happens. We already have
>>> a check for this in the client library, so this one is just for
>>> security reasons.
>>>
>>> Signed-off-by: David Henningsson <david.henningsson at canonical.com>
>>> ---
>>>   src/pulsecore/protocol-native.c | 7 +++++++
>>>   1 file changed, 7 insertions(+)
>>>
>>> diff --git a/src/pulsecore/protocol-native.c
>>> b/src/pulsecore/protocol-native.c
>>> index 6ec65d6..2ef1854 100644
>>> --- a/src/pulsecore/protocol-native.c
>>> +++ b/src/pulsecore/protocol-native.c
>>> @@ -4922,6 +4922,13 @@ static void pstream_memblock_callback(pa_pstream
>>> *p, uint32_t channel, int64_t o
>>>       if (playback_stream_isinstance(stream)) {
>>>           playback_stream *ps = PLAYBACK_STREAM(stream);
>>>
>>> +        size_t frame_size = pa_frame_size(&ps->sink_input->sample_spec);
>>> +        if (chunk->index % frame_size != 0 || chunk->length % frame_size
>>> != 0) {
>>> +            pa_log_warn("Client sent non-aligned memblock: index %d,
>>> length %d, frame size: %d",
>>> +                        (int) chunk->index, (int) chunk->length, (int)
>>> frame_size);
>>> +            return;
>>> +        }
>>> +
>>
>>
>> Do we need to release chunk->memblock if it exists here?
>
>
> No, unless you see something I don't? There is no call to
> pa_memblock_acquire above the added lines, so we should not call
> pa_memblock_release.
>
> Okay to push this series, given that I drop _se in the first patch?

You're right - please go ahead and push this set.

Thanks,
Arun


More information about the pulseaudio-discuss mailing list