[pulseaudio-discuss] [PATCH] module-rtp-recv: fix crash on empty UDP packets

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Thu Jun 5 04:13:10 PDT 2014


On Sat, 2014-05-31 at 23:48 +0600, Alexander E. Patrakov wrote:
> Signed-off-by: Alexander E. Patrakov <patrakov at gmail.com>
> 
> ---
>  src/modules/rtp/rtp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/modules/rtp/rtp.c b/src/modules/rtp/rtp.c
> index 570737e..8451386 100644
> --- a/src/modules/rtp/rtp.c
> +++ b/src/modules/rtp/rtp.c
> @@ -183,7 +183,7 @@ int pa_rtp_recv(pa_rtp_context *c, pa_memchunk *chunk, pa_mempool *pool, struct
>      }
>  
>      if (size <= 0)
> -        return 0;
> +        size = 1; /* invalid or empty packet, let the recvfrom() or size check fail */

I suppose you mean recvmsg(), not recvfrom()?

I think it would be good to explain the logic a bit more in the comment.
It may not be obvious to the reader why we don't just return -1 here.

-- 
Tanu



More information about the pulseaudio-discuss mailing list