After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 329043 - [ppc] fontilus will not thumbnail/display any fonts (endianness)
[ppc] fontilus will not thumbnail/display any fonts (endianness)
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: [obsolete] fonts:///
2.12.x
Other Linux
: Normal major
: ---
Assigned To: James Henstridge
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-01-29 05:07 UTC by Ed Catmur
Modified: 2006-01-30 12:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
329043.bugzilla.gnome.org-fontilus-endianness.patch (297 bytes, patch)
2006-01-29 05:31 UTC, Ed Catmur
none Details | Review

Description Ed Catmur 2006-01-29 05:07:46 UTC
Freetype compiled with -DFT_DEBUG_LEVEL_ERROR

$ gnome-font-viewer /usr/share/fonts/corefonts/timesi.ttf
FT_Stream_ReadLong: invalid i/o; pos = 0x0, size = 0x3c534
FT_Stream_ReadAt: invalid read; expected 128 bytes, got 0
could not load face 'file:///usr/share/fonts/corefonts/timesi.ttf'

This is a regression, introduced by commits http://cvs.gnome.org/viewcvs/gnome-control-center/vfs-methods/fontilus/ftstream-vfs.c?r1=1.11&r2=1.12 and http://cvs.gnome.org/viewcvs/gnome-control-center/vfs-methods/fontilus/ftstream-vfs.c?r1=1.11&r2=1.11.4.1 (to HEAD and 2.12 branch resp.)

--- ftstream-vfs.c	2004/12/25 14:37:33	1.11
+++ ftstream-vfs.c	2005/11/14 15:25:36	1.11.4.1
@@ -26,7 +26,7 @@
 #include FT_FREETYPE_H
 #include <libgnomevfs/gnome-vfs.h>
 
-static unsigned long
+static guint64 
 vfs_stream_read(FT_Stream stream,
 		unsigned long offset,
 		unsigned char *buffer,


Associated bug is bug 320157, generic cleanup.

The change is incorrect; vfs_stream_read is used only as read member in a FT_Stream struct, which has signature

  typedef unsigned long
  (*FT_Stream_IoFunc)( FT_Stream       stream,
                       unsigned long   offset,
                       unsigned char*  buffer,
                       unsigned long   count );

Thus unsigned long is the correct return type.

The problem is that if defined with return type guint64 and then cast to unsigned long (*FT_Stream_IoFunc) (...), vfs_stream_read pushes 8 bytes on the stack as return value, but on a 32-bit system only the first 4 bytes (sizeof (unsigned long)) are read off. This is not a problem on little-endian systems (x86) as the first 4 bytes correspond to the low 4 bytes of the returned guint64. However on big-endian (ppc) they are the high 4 bytes, which are all zero.
Comment 1 Ed Catmur 2006-01-29 05:31:46 UTC
Created attachment 58311 [details] [review]
329043.bugzilla.gnome.org-fontilus-endianness.patch

Patch; reversion of above commit. Confirmed fixes problem. Will need to be applied to 2.12 branch and MAIN.

Referred downstream: http://bugs.gentoo.org/show_bug.cgi?id=120790
Comment 2 Rodrigo Moya 2006-01-30 12:27:49 UTC
Committed to CVS, thanks