[vlc-devel] [PATCH] vasprintf: stop HEAP exceptions

ken kenself at optusnet.com.au
Thu Jan 8 01:41:01 CET 2009


On Wed, 2009-01-07 at 21:34 +0200, Rémi Denis-Courmont wrote:
> Le mardi 6 janvier 2009 03:00:47 ken, vous avez écrit :
> > vsnprintf produces "0paaaa" and returns a length of 6
> > vsprintf produces "0000AAAA" and returns a length of 8
> > So if vsprintf writes to the memory allocated on the basis of
> vsnprintf
> > it overflows by 2 characters
> 
> Well vsnprintf() is consistent with itself at least. Could it be that
> VLC is 
> pulling vsprintf() and vsnprintf() from mismatching run-times, such as
> MSVCRT 
> and a static mingw import library or something?

It is probably something like that. Its beyond my abilities to determine
where its coming from but I used nm and grep on the mingw libraries to
get:
/usr/i586-mingw32msvc/lib$ i586-mingw32msvc-nm *.a -A | grep vsnprintf
libcrtdll.a:dtpcs00311.o:00000000 I __imp___vsnprintf
libcrtdll.a:dtpcs00311.o:00000000 T __vsnprintf
libmingwex.a:mingw_snprintf.o:00000160 T ___mingw_vsnprintf
libmingwex.a:mingw_snprintf.o:00000160 T _vsnprintf
libmsvcr70.a:dlqcs00481.o:00000000 I __imp___vsnprintf
libmsvcr70.a:dlqcs00481.o:00000000 T __vsnprintf
libmsvcr70d.a:drqcs00481.o:00000000 I __imp___vsnprintf
libmsvcr70d.a:drqcs00481.o:00000000 T __vsnprintf
libmsvcr71.a:dxqcs00498.o:00000000 I __imp___vsnprintf
libmsvcr71.a:dxqcs00498.o:00000000 T __vsnprintf
libmsvcr71d.a:ddrcs00498.o:00000000 I __imp___vsnprintf
libmsvcr71d.a:ddrcs00498.o:00000000 T __vsnprintf
libmsvcr80.a:djrcs00508.o:00000000 I __imp___vsnprintf
libmsvcr80.a:djrcs00508.o:00000000 T __vsnprintf
libmsvcr80d.a:dprcs00508.o:00000000 I __imp___vsnprintf
libmsvcr80d.a:dprcs00508.o:00000000 T __vsnprintf
libmsvcrt.a:dzpcs00445.o:00000000 I __imp___vsnprintf
libmsvcrt.a:dzpcs00445.o:00000000 T __vsnprintf
libmsvcrtd.a:dfqcs00445.o:00000000 I __imp___vsnprintf
libmsvcrtd.a:dfqcs00445.o:00000000 T __vsnprintf
libntdll.a:dmsvbs00932.o:00000000 I __imp___vsnprintf
libntdll.a:dmsvbs00932.o:00000000 T __vsnprintf
libntoskrnl.a:dhawbs00667.o:00000000 I __imp___vsnprintf
libntoskrnl.a:dhawbs00667.o:00000000 T __vsnprintf

But I don't know which ones get linked or how to work it out.
Certainly vsprintf() result looks more correct than vsnprintf() so
vsnprintf() is probably the "rogue" procedure so it would be nice to
link the "right" version.





More information about the vlc-devel mailing list