freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] [freetype2] master 758d55e: [truetype] Catch infinite rec


From: Werner LEMBERG
Subject: Re: [ft-devel] [freetype2] master 758d55e: [truetype] Catch infinite recursion in subglyphs (#46372).
Date: Wed, 04 Nov 2015 20:13:16 +0100 (CET)

>> I challenge you to implement the Tortoise-and-the-Hare algorithm
>> for this!
>>
>> http://stackoverflow.com/questions/494830/how-to-determine-if-a-linked-list-has-a-cycle-using-only-two-memory-locations
> 
> I would rather use Brent's algorithm [...]

After some thinking I believe that such an algorithm is not
appropriate here.  TrueType subglyphs are processed (i.e., their
bytecode gets executed) while being collected, thus I want to abort as
quickly as possible.  Assuming that I'm at adding composite glyph n, I
have to check against the composite glyphs 1, 2, ..., n-1.  Adding a
composite element n+1, I have to immediately check against elements 1,
2, ..., n.  I don't see how Floyd or Brent could make this quicker.


    Werner

reply via email to

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