[Mingw-w64-public] Fwd: [vlc-devel] [PATCH] fix lfind errors on windows
Hey guys, Can I get some clarification in lfind on x64 not using size_t* but using unsinged int* What is the best course of action to take ? Is there anything that can be done in mingw-w64 Many Thanks Martell -- Forwarded message -- From: Rémi Denis-Courmont r...@remlab.net Date: Tue, Nov 4, 2014 at 1:25 PM Subject: Re: [vlc-devel] [PATCH] fix lfind errors on windows To: Mailing list for VLC media player developers vlc-de...@videolan.org Le 2014-11-04 15:03, Martell Malone a écrit : The issue here is there is nothing wrong with mingw-w64 as they link to msvcrt As defined here http://msdn.microsoft.com/en-us/library/a6xkkxfz.aspx [3] On little endian we can just ignore the warning but depending in the strictness of the build / package system this is not an option. I can conceive four cases: 1) lfind() is inline, 2) lfind() is statically linked and LTO is active, 3) lfind() is statically linked but LTO is inactive, 4) lfidn() is dynamically linked. The pointer aliasing violation is only a potential problem in cases 1 and 2. But binary compatibility with the CRT is only a concern in case 4. And even then, a small wrapper that converts back-and-forth would not be hard. So I fail to see an excuse. I'm totally not merging that ugly ifdef hack. -- Rémi Denis-Courmont ___ vlc-devel mailing list To unsubscribe or modify your subscription options: https://mailman.videolan.org/listinfo/vlc-devel -- ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] Fwd: [vlc-devel] [PATCH] fix lfind errors on windows
Issue here is that referenced object 'unsigned int' has different size to 'size_t' on Windows. Means that function might set only lower 32-bit to something meaningful, and so passing a size_t pointer to it could lead to corrupted value in it. Kai -- ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] Fwd: [vlc-devel] [PATCH] fix lfind errors on windows
Yes I agree with this. Especially because lfind is dynamically linked to msvcrt We didn't into this before on irc but could we add something similar to this in header in mingw64 #define _lfind(a,b,c,d,e) _lfind(a,b,(unsigned int*)c,d,e) Which explicitly casts it to (unsigned int *) Would this solve anything ? Many Thanks Martell On Tue, Nov 4, 2014 at 4:17 PM, Kai Tietz ktiet...@googlemail.com wrote: Issue here is that referenced object 'unsigned int' has different size to 'size_t' on Windows. Means that function might set only lower 32-bit to something meaningful, and so passing a size_t pointer to it could lead to corrupted value in it. Kai -- ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public -- ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] Fwd: [vlc-devel] [PATCH] fix lfind errors on windows
No, it wouldn't help, as we still have an strict-aliasing issue. And additionally the upper 32-bit of object are containing random values Kai 2014-11-04 17:36 GMT+01:00 Martell Malone martellmal...@gmail.com: Yes I agree with this. Especially because lfind is dynamically linked to msvcrt We didn't into this before on irc but could we add something similar to this in header in mingw64 #define _lfind(a,b,c,d,e) _lfind(a,b,(unsigned int*)c,d,e) Which explicitly casts it to (unsigned int *) Would this solve anything ? Many Thanks Martell On Tue, Nov 4, 2014 at 4:17 PM, Kai Tietz ktiet...@googlemail.com wrote: Issue here is that referenced object 'unsigned int' has different size to 'size_t' on Windows. Means that function might set only lower 32-bit to something meaningful, and so passing a size_t pointer to it could lead to corrupted value in it. Kai -- ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] Fwd: [vlc-devel] [PATCH] fix lfind errors on windows
The definition of the function appears to define num is the number of elements in the table If I am reading this correctly the value of size_t has to be set before calling lfind In this case the upper32 bits are already set to 0. Except in the case where size_t is more than 0x elements in num. :( We wouldn't be dealing with random values but we should have some kind of a warning on the size limitation. To cut to the point what's the best solution here then? Remi is dead set on this being a mingw-w64 issue and not that of vlc. I submitted a patch as you can see but no hack by using #ifdef __MINGW32__ will be accepted by them, I know it's the fault of the Microsoft engineer who decided to ignore the spec. I assume that at the time they were only concerned with i686 and not x86_64 heh Thanks for your time Martell On Tue, Nov 4, 2014 at 4:44 PM, Kai Tietz ktiet...@googlemail.com wrote: No, it wouldn't help, as we still have an strict-aliasing issue. And additionally the upper 32-bit of object are containing random values Kai 2014-11-04 17:36 GMT+01:00 Martell Malone martellmal...@gmail.com: Yes I agree with this. Especially because lfind is dynamically linked to msvcrt We didn't into this before on irc but could we add something similar to this in header in mingw64 #define _lfind(a,b,c,d,e) _lfind(a,b,(unsigned int*)c,d,e) Which explicitly casts it to (unsigned int *) Would this solve anything ? Many Thanks Martell On Tue, Nov 4, 2014 at 4:17 PM, Kai Tietz ktiet...@googlemail.com wrote: Issue here is that referenced object 'unsigned int' has different size to 'size_t' on Windows. Means that function might set only lower 32-bit to something meaningful, and so passing a size_t pointer to it could lead to corrupted value in it. Kai -- ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public -- ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public