Fwd: Possible Buffer Overflow

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

 



Hi Governa,

Not sure why it only happens when the number of players etc is
decreased. Anyway, indeed the buffer size in conf_switch is/was
hardcoded to MTU, this should affect to a bit lower memory usage (as
each conf port doesn't need to allocate its own buffer RX buffer, as
in the normal conf), the disadvantage is PCM frame size limitation as
you've experienced here. As you may know, this type of conf bridge is
originally to accommodate encoded audio from audio device (called
XXX-Direct in our wiki) which usually available on small/embedded
devices with such limited RAM.

So here are possible alternatives:
- use ptime=10 and mono channel for ring & ringback port (in app
level), so buffer size requirement should be 441*sizeof(uint16)
- FYI, just added compile time setting for buffer size of conf_switch
in SVN trunk r4443, you can adjust this accordingly.

BR,
nanang



On Wed, Mar 20, 2013 at 12:14 AM, Governa <affqlixo at gmail.com> wrote:
> Hi,
>
> While creating an new project based on PJSIP in an extremely RAM-limited
> target, I decreased the amount of players, recorders and conference ports in
> this way:
>
> #define PJSUA_MAX_PLAYERS 4
> #define PJSUA_MAX_RECORDERS 4
> #define PJSUA_MAX_CONF_PORTS (PJSUA_MAX_CALLS+2*PJSUA_MAX_PLAYERS)
>
> And my project started SEGFAULTing. I need to use the hardware at 44.1kHz
> and so the packets must be 10ms in size. But the ring and ringback ports
> where configured for an frame size of 1764(441*2*sizeof(pj_uint16)). When
> the conf_switch asks the ring port for an frame, it passes an buffer of size
> 1500 (MTU) to the ring port. And then the ring port overwrites some memory.
>
> The problem is triggered only when I decrease the number of
> players/recorders/ports. I have looked superficially at the conf_switch.c
> file but couldn't find out why it doesn't happen every time as it seems to
> me that the buffer is always of the same size.
>
> The problem happens if I change the value of PJSUA_DEFAULT_CLOCK_RATE to
> 44100 or if I use the "--snd-clock-rate=44100 --clock-rate=44100" parameters
> on command line.
>
> Was this expected(like: You shouldn't use this rate this way) or is there
> really something funny going on here?
>
> Thanks in advance,
> Fernando
>
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>



[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux