[FFmpeg-devel] Memory leak using bitstream filters with shared libs

Rich Felker dalias
Sun Mar 9 19:33:41 CET 2008


On Sun, Mar 09, 2008 at 08:21:48PM +0200, Uoti Urpala wrote:
> On Sun, 2008-03-09 at 09:26 -0400, Rich Felker wrote:
> > On Sun, Mar 09, 2008 at 04:48:11AM +0200, Uoti Urpala wrote:
> > > On Sat, 2008-03-08 at 19:23 -0500, Rich Felker wrote:
> > > > It's actually an implementation bug since the C language requires that
> > > > the addresses match. I suspect it's binutils doing something stupid
> > > > due to -Bsymbolic. Anyway this sort of problem is common enough that
> > > 
> > > It's binutils doing what -Bsymbolic is documented to do - binding
> > > references to global symbols to the definition within the shared
> > > library. If the main program is compiled without -fPIC then functions
> > > are normally bound to the main program's PLT entry (if one exists for
> > > the function in question), and that's what other code will use.
> > 
> > This is a bug, plain and simple, in the linker. Binding _call_
> > references is valid, but binding address-of references is not. The
> > latter must be left either as a GOT lookup (if compiling PIC code) or
> > a textrel (for non-PIC code).
> 
> Must be left as a GOT lookup - lookup of what? If you leave it the same
> lookup as without -Bsymbolic then it could return a function completely
> different from the one in the library.

Only for code that has undefined behavior already! What binutils is
doing, and what you're defending them in regard to, is breaking valid
C code for the sake of invalid C code with undefined behavior.

Rich




More information about the ffmpeg-devel mailing list