[Freeswitch-users] BUG FIX: "Buffer size sanity check failed!" drops FAX receiving unneeded

Anthony Minessale anthony.minessale at gmail.com
Thu Apr 7 05:30:38 MSD 2011


I think I have a fix for it.
The patch provided would lead to memory corruption by feeding data to
the codec decoder that probably is not even really audio data with a
length that would cause a buffer overflow.

Instead when this happens I think I can write out all zeros to the
buffer at the typical packet len and return that.
Since these frames really should be ignored anyway.

I would like to see the pcaps nevertheless so I can identify why it happens.


On Wed, Apr 6, 2011 at 5:15 PM, Matt Paine
<mattzerah+freeswitch at gmail.com> wrote:
> I can second this behaviour... It wont be the weekend until I can actually
> get any packet captures for the unpatched code, I can certianly find some
> full freeswitch console logs if that will help.
> Has a JIRA bug been filed for this yet? What is the number so I can
> contribute?
> Matt.
>
> On 7 April 2011 02:05, Anthony Minessale <anthony.minessale at gmail.com>
> wrote:
>>
>> Can you please get a pcap of a single call (without your patch) as
>> well as a full capture of the freeswitch console logs and post it to
>> JIRA.
>>
>> Are you using the described TDM inside FreeSWITCH or is this a SIP
>> call from an Asterisk machine?
>>
>>
>>
>> On Mon, Apr 4, 2011 at 4:07 AM, Markus Mueller <freeswitch at priv.de> wrote:
>> > Hello FreeSwitch users and programmers,
>> >
>> > I found a problem on receiving faxes and want to share a working patch
>> > for this. The problem is that on receiving a fax, it is unneeded aborted
>> > by a sanity check. Sanity checks are fine, but a unneeded abort instead
>> > of a warning is in productive versions not the best solution.
>> >
>> > The message apearing is:
>> >
>> > 2011-04-04 10:44:52.060860 [CRIT] switch_core_codec.c:660 Buffer size
>> > sanity check failed!
>> >
>> > which is normaly aborting in receiving the fax. Simply decreasing this
>> > fault to a warning let the server receive the fax without any problems.
>> > After the patch the message apears up to five times per fax before the
>> > fax is beeing accepted. I am using libpri with the three HFC ISDN Cards
>> > and the DAHDI from Debian Squeeze 6.0. For more informations about my
>> > hardware just write me an email.
>> >
>> > Regards,
>> > Markus Mueller
>> > http://projekte.priv.de/
>> >
>> > root at sip:/usr/local/src/freeswitch/src# diff -U 4 switch_core_codec.c*
>> > --- switch_core_codec.c 2011-03-14 10:49:17.000000000 +0100
>> > +++ switch_core_codec.c.org     2011-03-14 10:47:02.000000000 +0100
>> > @@ -657,9 +657,9 @@
>> >                 uint32_t frames = encoded_data_len /
>> > codec->implementation->encoded_bytes_per_packet;
>> >
>> >                 if (frames &&
>> > codec->implementation->decoded_bytes_per_packet * frames >
>> > *decoded_data_len) {
>> >                         switch_log_printf(SWITCH_CHANNEL_LOG,
>> > SWITCH_LOG_CRIT, "Buffer size sanity check failed!\n");
>> > -                       // return SWITCH_STATUS_GENERR;
>> > +                       return SWITCH_STATUS_GENERR;
>> >                 }
>> >         }
>> >
>> >         if (codec->mutex) switch_mutex_lock(codec->mutex);
>> > root at sip:/usr/local/src/freeswitch/src#
>> >
>> >
>> > _______________________________________________
>> > FreeSWITCH-users mailing list
>> > FreeSWITCH-users at lists.freeswitch.org
>> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> > UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> > http://www.freeswitch.org
>> >
>>
>>
>>
>> --
>> Anthony Minessale II
>>
>> FreeSWITCH http://www.freeswitch.org/
>> ClueCon http://www.cluecon.com/
>> Twitter: http://twitter.com/FreeSWITCH_wire
>>
>> AIM: anthm
>> MSN:anthony_minessale at hotmail.com
>> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
>> IRC: irc.freenode.net #freeswitch
>>
>> FreeSWITCH Developer Conference
>> sip:888 at conference.freeswitch.org
>> googletalk:conf+888 at conference.freeswitch.org
>> pstn:+19193869900
>>
>> _______________________________________________
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>
>
> _______________________________________________
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>



-- 
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale at hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org
googletalk:conf+888 at conference.freeswitch.org
pstn:+19193869900



More information about the FreeSWITCH-users mailing list