linphone-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Linphone-developers] Possible bug in mediastreamer eventqueue


From: Simon Morlat
Subject: Re: [Linphone-developers] Possible bug in mediastreamer eventqueue
Date: Wed, 12 Oct 2011 09:57:20 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110922 Thunderbird/3.1.15

Hi Frédérik,

You are right. Thank you for noticing this waste of memory.
I fixed in git.

Simon

On 11/10/2011 18:46, Frédérik Rouleau wrote:
Hello everyone,

I have noticed something weird in mediastreamer and I think that it might be a bug.
In file eventqueue.c, the write_event function is using the last 16bits of the event_id to get the argument size.

static void write_event(MSEventQueue *q, MSFilter *f, unsigned int ev_id, void *arg){
    int argsize=ev_id & 0xffff;

But the event_id are defined using the following macros:

#define MS_FILTER_EVENT(_id_,_count_,_argtype_) \
    MS_FILTER_METHOD_ID(_id_,_count_,sizeof(_argtype_))
#define MS_FILTER_METHOD_ID(_id_,_cnt_,_argsize_) \
    (  (((unsigned long)(_id_)) & 0xFFFF)<<16 | (_cnt_<<8) | (_argsize_ & 0xFF ))

So if I have a correct understanding, the "count" parameter, which is supposed to represent a function index, will be taken in account for the size, leading to an largely overevaluated size.
For example, the MS_CONF_CHANNEL_VOLUME event would have a size of 0x0304 (for 32bits plateform), so 772 bytes for a single pointer !!!
#define MS_CONF_CHANNEL_VOLUME    MS_FILTER_EVENT(MS_CONF_ID, 3, void*)

I think that write_event function should be written like the following instead:
static void write_event(MSEventQueue *q, MSFilter *f, unsigned int ev_id, void *arg){
    int argsize=ev_id & 0xff;

Regards,
_______________________________________________ Linphone-developers mailing list address@hidden https://lists.nongnu.org/mailman/listinfo/linphone-developers


reply via email to

[Prev in Thread] Current Thread [Next in Thread]