help-libidn
[Top][All Lists]
Advanced

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

Re: Fix Win64 oddity in libidn 1.38 stringprep


From: Simon Josefsson
Subject: Re: Fix Win64 oddity in libidn 1.38 stringprep
Date: Sun, 20 Feb 2022 08:34:50 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Francesco Pretto <ceztko@gmail.com> writes:

> 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.

Thanks.  What error message do you get, or how did you notice this?  We
do build and self-test Win64 via CI/CD so I'm surprised to see this.
Your code analysis have a point though, although I'm not certain your
patch is the proper fix -- maybe 'glong' should be mapped to a different
type instead.

/Simon

Attachment: signature.asc
Description: PGP signature


reply via email to

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