[Freeswitch-users] Fax problem

Alexey Melnichuk alexeymelnichuck at gmail.com
Wed Jul 8 13:48:01 MSD 2015


FreeSWITCH Version 1.4.20+git~20150703T164215Z~b95362f965~32bit (git b95362f 
2015-07-03 16:42:15Z 32bit)

I think I found bug in spandsp.

`t4_image_put_handler_t` defined as (__cdecl)

typedef int (*t4_image_put_handler_t)(void *user_data, const uint8_t buf[], 
size_t len);

But `tXX_decode_put` functions defined as `__stdcall`.
So when I do

s->image_put_handler = (t4_image_put_handler_t) t4_t6_decode_put;
...
s->image_put_handler(...)

I got AV.

After I declare t4_image_put_handler_t as __stdcall problem solved.
(Alse need update declaretion to `pre_encoded_put` function)

But I start getting heap corruption on
`span_free((char *) s->tiff.file);`

Problem is that it uses `strdup` function with different allocator.
So I just copy function to `alloc.c`

SPAN_DECLARE(char *) span_strdup(const char *str)
{
    char *sdup;
    size_t len = strlen(str) + 1;

    sdup = (char *) span_alloc(len);
    memcpy(sdup, str, len);

    return sdup;
}

And use it as
ds->tiff.file = span_strdup(file);





Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list