help-libidn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fix Win64 oddity in libidn 1.38 stringprep


From: Francesco Pretto
Subject: Fix Win64 oddity in libidn 1.38 stringprep
Date: Sun, 6 Feb 2022 12:54:09 +0100

Hello, I have a fix for libidn 1.38 regarding the Win64 platform. The use of glong inĀ stringprep_utf8_to_ucs4[1] and other locations in nfkc.c is incorrect. The glong is a define for long: use of long type is unsafe in cross-platform code that spans through unix and windows platforms compiled with MSVC. MSVC will not scale to a 64 bit sized type when targeting for x64 hence the cast from size_t to glong pointers is unsafe and does indeed break Win64 builds. My fix is just deleting the dangerous glong define and use the safer (and more meaningful) gsize/gssize_t types instead.

You can find the patch attached. It applies to libidn 1.38 source tarball.

Cheers,
Francesco

[1] https://git.savannah.gnu.org/cgit/libidn.git/tree/lib/nfkc.c#n1019

Attachment: fix-use-of-long-win64.diff
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]