freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] Question about cidparse.c/cid_parser_new( )


From: Taek Kwan(TK) Lee
Subject: Re: [ft-devel] Question about cidparse.c/cid_parser_new( )
Date: Fri, 4 Nov 2005 10:22:30 -0500

Hi,
Thanks for the note. Sorry but I do not have the test case, I just
looked at the code and found out the bug.
And I think there should be more change in this code section: 'limit'
should be reset by 'buffer + readsize' in where readsize is actual
read size.

Thanks,
TK

2005/11/3, address@hidden <address@hidden>:
> Hi
>
> On Wed, 2 Nov 2005 11:55:08 -0500
> "Taek Kwan(TK) Lee" <address@hidden> wrote:
>
> >When this function locates 'StartData' , it reads in by '256 + 10 -
> >buff_len' from stream. Sometimes, the font data after 'StartData' is
> >not very long and stream read function fails in this case.
> >I think stream->size should be considered to get the correct reading length.
>
> I think following patch realizes your proposal.
> I want to test, could you provide some example
> CIDFont that original FreeType cannot parse correctly?
>
> Regards,
> mpsuzuki
>
>
> Index: src/cid/cidparse.c
> ===================================================================
> RCS file: /cvsroot/freetype/freetype2/src/cid/cidparse.c,v
> retrieving revision 1.44
> diff -u -r1.44 cidparse.c
> --- src/cid/cidparse.c  13 Feb 2005 21:42:42 -0000      1.44
> +++ src/cid/cidparse.c  4 Nov 2005 02:33:28 -0000
> @@ -101,8 +101,15 @@
>
>       p = buffer + buff_len;
>
> -      if ( FT_STREAM_READ( p, 256 + 10 - buff_len ) )
> -        goto Exit;
> +      {
> +        FT_ULong  oldpos       = FT_STREAM_POS();
> +        FT_ULong  size         = stream->size - oldpos;
> +        FT_Int    max_read_len = 256 + 10 - buff_len;
> +
> +
> +        if ( FT_STREAM_READ( p, max_read_len > size ? size : max_read_len ) )
> +          goto Exit;
> +      }
>
>       top_position = FT_STREAM_POS() - buff_len;
>       buff_len     = 256 + 10;
>
>




reply via email to

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