[Bug 513582] segfault in FTC_CMapCache_Lookup()

bugzilla at redhat.com bugzilla at redhat.com
Wed Jul 29 19:14:24 UTC 2009


Please do not reply directly to this email. All additional
comments should be made in the comments box of this bug.


https://bugzilla.redhat.com/show_bug.cgi?id=513582





--- Comment #17 from Kevin Kofler <kevin at tigcc.ticalc.org>  2009-07-29 15:14:23 EDT ---
Hmmm, the problem is that even with that aliasing issue fixed, you're still
casting pointers of different types, which is both a likely violation of
aliasing rules and invalid C++.

You have a structure like this:
  /* the cmap cache node */
  typedef struct  FTC_CMapNodeRec_
  {
    FTC_NodeRec  node;
    FTC_FaceID   face_id;
    FT_UInt      cmap_index;
    FT_UInt32    first;                         /* first character in node */
    FT_UInt16    indices[FTC_CMAP_INDICES_MAX]; /* array of glyph indices  */

  } FTC_CMapNodeRec, *FTC_CMapNode;
and then you're trying to use an FTC_CMapNode (an FTC_CMapNodeRec *) as an
FTC_Node (an FTC_NodeRec *). The GCC C frontend has special rules to allow this
type of "poor man's inheritance", in C++ you can't do that without actual
inheritance.

You should be using &(node->node) rather than just node where you're passing
your FTC_CMapNode to functions which expect an FTC_Node.

-- 
Configure bugmail: https://bugzilla.redhat.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.




More information about the fonts-bugs mailing list