bugThe FreeType Project - Bugs: bug #25151, produces syscalls with EINVAL

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #25151: produces syscalls with EINVAL

Submitter:  Behdad Esfahbod <behdad>
Submitted:  Mon 22 Dec 2008 05:46:49 PM UTC
   
 
Severity:  3 - Normal Item Group:  None
Status:  Fixed Privacy:  Public
Assigned to:  wl Open/Closed:  Closed
Planned Release:  2.3.8

Mon 22 Dec 2008 08:33:28 PM UTC, comment #2: 

Thanks.

No, it wasn't crashing or anything, at least the bug doesn't say so.  Just that the kernel thinks this input is invalid.

Behdad Esfahbod <behdad>
Mon 22 Dec 2008 06:09:34 PM UTC, comment #1: 

I've applied this, thanks.  BTW, what is meant with
`the kernel does not like this'?  Does it cause an `oops'?
Then the kernel should be fixed too (assuming we are talking
about Linux).

Werner LEMBERG <wl>
Group administrator
Mon 22 Dec 2008 05:46:49 PM UTC, original submission:  

Bugreport I got at Red Hat:
https://bugzilla.redhat.com/show_bug.cgi?id=477607

It says: Our IDS work shows that the freetype library causes mmap syscalls with EINVAL return codes. This is because its not checking the length of the file before calling mmap. If the file is opened readonly and the length is 0, the kernel does not like it.

And suggests this patch:

diff -urp freetype-2.3.5.orig/builds/unix/ftsystem.c freetype-2.3.5/builds/unix/ftsystem.c
--- freetype-2.3.5.orig/builds/unix/ftsystem.c 2008-12-22 06:52:35.000000000 -0500
+++ freetype-2.3.5/builds/unix/ftsystem.c 2008-12-22 06:55:29.000000000 -0500
@@ -280,6 +280,11 @@
       FT_ERROR(( "FT_Stream_Open: file is too big" ));
       goto Fail_Map;
     }
+    else if ( stat_buf.st_size == 0 )
+    {
+      FT_ERROR(( "FT_Stream_Open: zero length file" ));
+      goto Fail_Map;
+    }
 
     /* This cast potentially truncates a 64bit to 32bit! */
     stream->size = (unsigned long)stat_buf.st_size;

Behdad Esfahbod <behdad>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by wl (Posted a comment)
  • -email is unavailable- added by behdad (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-12-22 wl StatusNone Fixed
        Assigned toNone wl
        Open/ClosedOpen Closed
        Planned ReleaseNone 2.3.8

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code