You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 4, 2018. It is now read-only.
uv_fs_readdir uses swprintf, but there exist two different swprintf due to legacy issues: one with count argument (iso-conforming) and without count (non-conforming). msvc and mingw-w64 (!= mingw) provide iso-conforming functions as default.
libuv uses iso-conforming one as default, and uses non-conforming one if _CRT_NON_CONFORMING_SWPRINTFS is defined. (src/win/fs.c)
However, mingw only provides non-conforming one regardless of the macro. So libuv calls swprintf(path2, len + 3, fmt, pathw); but mingw only knows 3-arg function. This causes warning on build time...
src/win/fs.c:744:3: warning: passing argument 2 of 'swprintf' makes pointer from integer without a cast
...and it segfaults on runtime.
This only occurs on mingw, not mingw-w64 nor msvc.
Easy workaround is to build libuv with make CFLAGS="-D_CRT_NON_CONFORMING_SWPRINTFS". This will also work for mingw-w64 and msvc.
The text was updated successfully, but these errors were encountered:
mingw 4.1 will provide iso-conforming swprintf: http://sourceforge.net/p/mingw/bugs/2018/
However 4.1 doesn't provide non-conforming version, so CFLAGS="-D_CRT_NON_CONFORMING_SWPRINTFS" trick will make broken libuv on mingw 4.1.
I think we should check mingw version instead of _CRT_NON_CONFORMING_SWPRINTFS, since the awkward thing occurs only on mingw < 4.1, not on msvc/mingw-w64.
Test code is here.
uv_fs_readdir
usesswprintf
, but there exist two different swprintf due to legacy issues: one withcount
argument (iso-conforming) and withoutcount
(non-conforming). msvc and mingw-w64 (!= mingw) provide iso-conforming functions as default.libuv uses iso-conforming one as default, and uses non-conforming one if
_CRT_NON_CONFORMING_SWPRINTFS
is defined. (src/win/fs.c)However, mingw only provides non-conforming one regardless of the macro. So libuv calls
swprintf(path2, len + 3, fmt, pathw);
but mingw only knows 3-arg function. This causes warning on build time......and it segfaults on runtime.
This only occurs on mingw, not mingw-w64 nor msvc.
Easy workaround is to build libuv with
make CFLAGS="-D_CRT_NON_CONFORMING_SWPRINTFS"
. This will also work for mingw-w64 and msvc.The text was updated successfully, but these errors were encountered: