id	summary	reporter	owner	description	type	status	priority	component	version	resolution	keywords	cc	blockedby	blocking	reproduced	analyzed
1940	segfault on av_malloc()	leandrosansilva		"I'm using ffmpeg in a c++ project and at a point at my code I try to call av_malloc() bu it results in a segfault. As I'm using ubuntu amd64 arch, I don't think I don't have enough memory. It's also strange it happens only in one point of my code, where I create a new pointer and just assign the return of av_malloc() (here the size is 460800) as parameter. It causes a segfault before return. It makes me think if libav keeps a internal state of general memory alocation system...

The ffmpeg version I'm using is the commit e94f4294746d50ef7b25993fa59a9be32023d3bb checked out today (21th November) from master branch.

The backtrace related to this problem is:

{{{
Program received signal SIGSEGV, Segmentation fault.
_int_malloc (av=0x7ffff6b63720, bytes=460880) at malloc.c:3868
3868    malloc.c: Arquivo ou diretório não encontrado.
(gdb) bt full
#0  _int_malloc (av=0x7ffff6b63720, bytes=460880) at malloc.c:3868
        p = <optimized out>
        iters = <optimized out>
        nb = 460896
        idx = <optimized out>
        bin = <optimized out>
        victim = 0x1d6fae0
        size = 7740398493674188424
        victim_index = <optimized out>
        remainder = 0x1de0340
        remainder_size = <optimized out>
        block = 4
        bit = 1073741824
        map = <optimized out>
        fwd = <optimized out>
        bck = <optimized out>
        errstr = 0x0
        __func__ = ""_int_malloc""
#1  0x00007ffff682c801 in _int_memalign (av=0x7ffff6b63720, alignment=32, bytes=<optimized out>) at malloc.c:4492
        nb = 460816
        m = <optimized out>
        p = <optimized out>
        brk = <optimized out>
        newp = <optimized out>
        newsize = <optimized out>
        leadsize = <optimized out>
        remainder = <optimized out>
        remainder_size = <optimized out>
        size = <optimized out>
        __func__ = ""_int_memalign""
#2  0x00007ffff682eac6 in __GI___libc_memalign (alignment=32, bytes=460800) at malloc.c:3102
        ar_ptr = <optimized out>
        p = <optimized out>
        hook = <optimized out>
        __func__ = ""__libc_memalign""
#3  0x00007ffff682fd09 in __posix_memalign (memptr=0x7fffffffdc88, alignment=<optimized out>, size=<optimized out>) at malloc.c:5038
        mem = <optimized out>
        hook = <optimized out>
#4  0x0000000000cfb22a in av_malloc (size=460800) at libavutil/mem.c:97
        ptr = 0x0
#5  av_mallocz (size=460800) at libavutil/mem.c:203

(...) my code bt (...)

}}}"	defect	closed	normal	avutil	git-master	invalid					0	0
