[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Linphone-developers] Possible bug in mediastreamer eventqueue
From: |
Frédérik Rouleau |
Subject: |
[Linphone-developers] Possible bug in mediastreamer eventqueue |
Date: |
Tue, 11 Oct 2011 18:46:02 +0200 |
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] Possible bug in mediastreamer eventqueue,
Frédérik Rouleau <=