[Top][All Lists]

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

Re: a bug in ft2 (uninitialized variable)

From: Just van Rossum
Subject: Re: a bug in ft2 (uninitialized variable)
Date: Tue, 1 Aug 2000 08:49:37 +0100

At 3:02 PM +0900 01-08-2000, Hirotsugu Kakugawa wrote:
>In FreeType2, 'args' of FT_Open_Args type is not initialized.
>If C compiler does not initialize the variable,
>an unexpected situation will occur.
>I found such a code:
>in src/base/ftobj.c
>  FT_New_Face()
>  FT_New_Memory_Face()
>  FT_Attach_File()
>in src/base/ftmac.c
>  open_face_from_buffer()
>  FT_New_Face()

Well, yes and no. With wrong usage of the FT_Open_Args argument, it will
behave unexpectedly, but it only uses the fields specified by the
args.flags fields. So you always have to specify args.flags, and depending
on that value, you have to initialize one or more other fields. This
example (from ftmac.c)

    args.flags = ft_open_stream; = stream;

is correct: because of the ft_open_stream flag, *only* the
field is accessed later, the other fields are ignored. I agree it's
somewhat brittle, though...


reply via email to

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