[asterisk-dev] res_fax_spandsp segfaults during fax detection - FIXED?

Michal Rybárik michal at rybarik.sk
Fri Jan 31 22:49:42 CST 2014


Hello Pavel,

On 01/31/2014 07:59 AM, Pavel Troller wrote:
>> This code will translate non-slinear frames to slinear, just before they
>> are sent to libspandsp for v21detection. With this patch applied, v21
>> detection is done also for RTP (SIP) alaw/ulaw frames, so maybe SIP/G711
>> <->  SIP/T38 gateway will work too. I tested DAHDI<->  SIP/T38, gateway
>> works both ways, voice calls too. Is it better now? :o)
> I fully understand the code, but I'm not trained enough in the Asterisk
> internals to respond to questions, which immediately appeared in my head:
> 1) In the original code, the result from fax_gateway_detect_v21() is returned.
> Now, you are returning the original frame. I quickly looked at the above
> routine and it in turn calls fax_gateway_request_t38() and returns its
> result (but not always), and in the fax_gateway_request_t38() function
> they are also returning different things according to results of the
> program flow. So, is it really safe to do this ? Are you sure, that the
> real result is really unneccessary ?
> 2) Are you sure, that ast_translate() will always allocate a new buffer for
> tmpframe ? Is it written somewhere ? Isn't it possible that it will just
> reallocate the buffer for the original frame to increase its size and return
> its pointer, so by doing ast_frfree() you would just deallocate the same
> buffer, thus making big troubles ? You would find it by checking that
> tmpframe != f...
>    As you can see, I'm very careful, or maybe even a bit conservative, with
> patching things, unless I really DEEPLY understand, how they are going...
> So, I believe, that you really studied the code enough to be sure, that
> you can really clear my doubts by your deep knowledge... I didn't have time
> to study the code to such extent...

Answering these questions is not easy for me too, there are some parts 
of res_fax code which I don't fully understand. So I rather reworked the 
patch and moved it to another place, where functionality is easier to 
understand, and when it shouldn't harm anything. I uploaded diff to 
JIRA  - https://issues.asterisk.org/jira/browse/ASTERISK-20149

Regards,
Michal Rybarik



More information about the asterisk-dev mailing list