Bug 1303268

Summary: [freetype] : running 32 bit apps on amd64 arch which use freetype so, not using stat64
Product: Red Hat Enterprise Linux 7 Reporter: zuogang
Component: freetypeAssignee: Marek Kašík <mkasik>
Status: CLOSED ERRATA QA Contact: Desktop QE <desktop-qa-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: tpelka
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: freetype-2.4.11-12.el7 Doc Type: Bug Fix
Doc Text:
Cause: A font file with inode number higher than or equal to 2^31 opened by a 32bit version of freetype library. Consequence: Opening of such font file failed. Fix: Add support for Large File Support by defining _FILE_OFFSET_BITS to 64. Result: Font files with inode numbers higher than or equal to 2^31 are opened correctly.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-04 01:26:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
source of sfnt2fon none

Description zuogang 2016-01-30 02:53:51 UTC
Description of problem:

running 32 bit apps on amd64 arch which use freetype so, not using stat64 

Version-Release number of selected component (if applicable):
freetype-2.4.11-11.el7 i686

How reproducible:

using wine's tool sfnt2fon within win1.9.2 , when the ttf file 's stat info struct has some field exceed the old stat struct's member, the error overflow returned.

sfnt2fon -o coue1255.fon courier.ttf -d 128 13,1255,8

(gdb) shell stat courier.ttf 
  File: ‘courier.ttf’
  Size: 17884           Blocks: 40         IO Block: 4096   regular file
Device: fd00h/64768d    Inode: 7079994055  Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/    zoge)   Gid: ( 1000/    zoge)
Access: 2016-01-29 11:10:33.653143506 +0800
Modify: 2016-01-22 22:28:32.000000000 +0800
Change: 2016-01-28 19:45:15.078754468 +0800
 Birth: -

on my machine and my fs, the inode field exceed u32.

I define a macro before the stat.h, every thing is ok.

--- a/builds/unix/ftsystem.c 2009-03-14 21:45:26.000000000 +0800
+++ b/builds/unix/ftsystem.c 2016-01-30 10:28:10.199751965 +0800
@@ -58,6 +58,7 @@
 
 
 #include <sys/types.h>
+#define __USE_FILE_OFFSET64 1
 #include <sys/stat.h>
 
 #ifdef HAVE_FCNTL_H


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 Marek Kašík 2016-02-02 10:16:43 UTC
Hi zougang,

is the specific version of wine you use available via a repository? Which version of freetype are you compiling? How do you run the gdb?
Also, you report that this happened in Red Hat Enterprise Linux 7.4 which does not exist. Which version of Red Hat Enterprise Linux do you use?
I would like to try to reproduce the problem.

Regards

Comment 3 zuogang 2016-02-03 07:23:50 UTC
(In reply to Marek Kašík from comment #2)
> Hi zougang,
> 
> is the specific version of wine you use available via a repository? Which

yes, wine 1.9.2 upstream version

> version of freetype are you compiling? How do you run the gdb?
freetype-2.4.11-11.el7 i686

run the gdb : 
gdb  sfnt2fon 
set args -o coue1255.fon courier.ttf -d 128 13,1255,8

b XXX

run



> Also, you report that this happened in Red Hat Enterprise Linux 7.4 which
> does not exist. Which version of Red Hat Enterprise Linux do you use?
> I would like to try to reproduce the problem.
how to check the el's version? I upgraded from the very beginning verison, I think 7.4 is the newest version, so ....

freetype-2.4.11-11.el7 i686----from the pkg's version can you get the os verison?

last, I think this question is because my disk and fs layout(maybe none business of the os?), the courier.ttf  file's stat info has some field very big, so the old stat syscall failed with overflow. (the field inode below : Inode: 7079994055  )

(gdb) shell stat courier.ttf 
  File: ‘courier.ttf’
  Size: 17884           Blocks: 40         IO Block: 4096   regular file
Device: fd00h/64768d    Inode: 7079994055  Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/    zoge)   Gid: ( 1000/    zoge)
Access: 2016-01-29 11:10:33.653143506 +0800
Modify: 2016-01-22 22:28:32.000000000 +0800
Change: 2016-01-28 19:45:15.078754468 +0800
 Birth: -


> 
> Regards

Comment 4 zuogang 2016-02-03 07:32:07 UTC
Created attachment 1120652 [details]
source of sfnt2fon

Comment 5 Marek Kašík 2016-02-10 17:01:09 UTC
Thank you for the info. I was able to reproduce the problem. Setting _FILE_OFFSET_BITS to 64 at configure time solves the problem for me.
I'm proposing the fix for 7.3.

Comment 9 errata-xmlrpc 2016-11-04 01:26:49 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2234.html