freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] Optional fields and stream reading in WOFF2


From: Werner LEMBERG
Subject: Re: [ft-devel] Optional fields and stream reading in WOFF2
Date: Tue, 11 Jun 2019 22:03:58 +0200 (CEST)

> While trying to read the table directory, I am following these steps:
>
> 1. Define and assign  `FT_Byte* p = stream->cursor;'
>
> 2. After reading and validating the header, I say something like
> (assuming stream is within limit):
>
>   table->FlagByte = FT_NEXT_BYTE( p );
>
> this gives a segmentation fault. Any ideas?

My bad, sorry.  It's not `FT_NEXT_*' but either `FT_Get_*' or
`FT_READ_*'.  From `ftstream.h':

  The `FT_GET_XXX` macros use an implicit 'stream' variable.

  Note that a call to `FT_STREAM_SEEK` or `FT_STREAM_POS` has **no**
  effect on `FT_GET_XXX`!  They operate on `stream->pos`, while
  `FT_GET_XXX` use `stream->cursor`.


  The `FT_READ_XXX' macros use implicit `stream' and `error'
  variables.

  `FT_READ_XXX' can be controlled with `FT_STREAM_SEEK' and
  `FT_STREAM_POS'.  They use the full machinery to check whether a
  read is valid.


    Werner



reply via email to

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