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=800585
Tomas Hoger thoger@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |CLOSED Resolution| |NOTABUG Summary|CVE-2012-1129 freetype: |CVE-2012-1129 freetype: |Out-of heap-based buffer |heap off-by-one buffer |read when parsing certain |underflow in Type42 parser |SFNT strings by Type42 font |t42_parse_sfnts() (#35602) |parser (FU#35602) | Status Whiteboard|impact=low,public=20120223, |impact=low,public=20120223, |reported=20120302,source=go |reported=20120302,source=se |ogle,cvss2=4.3/AV:N/AC:M/Au |calert,cvss2=2.6/AV:N/AC:H/ |:N/C:N/I:N/A:P,rhel-5/freet |Au:N/C:N/I:N/A:P,rhel-5/fre |ype=affected,rhel-6/freetyp |etype=affected,rhel-6/freet |e=affected,fedora-all/freet |ype=affected,fedora-all/fre |ype=affected |etype=affected,fedora-all/m | |ingw32-freetype=affected Last Closed| |2012-03-15 08:28:18
--- Comment #5 from Tomas Hoger thoger@redhat.com 2012-03-15 08:28:18 EDT --- This bug is not a security problem. Affected code is the following code from src/type42/t42parse.c :
http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/src/type42/t42p...
610 /* A string can have a trailing zero byte for padding. Ignore it. */ 611 if ( string_buf[string_size - 1] == 0 && ( string_size % 2 == 1 ) ) 612 string_size--;
Here problem occurs when string_size == 0. In that case string_buf[string_size - 1] reads one byte right before the beginning of the heap-based string_buf[] buffer. Such one byte buffer underflow can only lead to program crash when string_buf[] starts at the memory page boundary and the previous page is not mapped. However, that can not happen with the current glibc malloc() implementation. A memory address returned to a program by malloc() function has additional malloc header located right before it. Hence string_buf[string_size - 1] reads part of that header and can not access unmapped memory.
This bug can be detected by memory usage checkers as valgrind or AddressSanitizer, but does not lead to crash during the normal use.
The value read from the malloc header has no impact on whether the "if" expression is evaluated as true or falls. The second part of the "if" expression is: ( string_size % 2 == 1 ) which evaluates to false when string_size == 0. Hence string_size is not decremented and remains 0.
The code immediately following is:
614 if ( !string_size ) 615 { 616 FT_ERROR(( "t42_parse_sfnts: invalid string\n" )); 617 error = T42_Err_Invalid_File_Format; 618 goto Fail; 619 }
which causes the font file to be rejected as invalid.
Statement:
This bug is not a security issue. For detailed explanation, refer to: https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2012-1129#c5
fonts-bugs@lists.fedoraproject.org