Closed Bug 1194004 Opened 9 years ago Closed 9 years ago

Crash [@ graphite2::Silf::readClassMap]

Categories

(Core :: Graphics: Text, defect)

x86_64
Linux
defect
Not set
critical

Tracking

()

RESOLVED FIXED

People

(Reporter: decoder, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: crash, sec-moderate, testcase, Whiteboard: sec-high+ without OTS [gfx-noted])

Crash Data

Attachments

(1 file)

The attached testcase crashes on graphite2 revision fa8d4398dded (run through the gr2fonttest command line utility).

Backtrace:

==23318==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000c5d8 at pc 0x7fc9faea9102 bp 0x7fffe8362c70 sp 0x7fffe8362c68
READ of size 2 at 0x60200000c5d8 thread T0
    #0 0x7fc9faea9101 in graphite2::Silf::readClassMap(unsigned char const*, unsigned long, unsigned int, graphite2::Error&) /src/Silf.cpp:287
    #1 0x7fc9faea5c24 in graphite2::Silf::readGraphite(unsigned char const*, unsigned long, graphite2::Face&, unsigned int) /src/Silf.cpp:190
    #2 0x7fc9fae3afb8 in graphite2::Face::readGraphite(graphite2::Face::Table const&) /src/Face.cpp:149
    #3 0x7fc9fadd6bef in (anonymous namespace)::load_face(graphite2::Face&, unsigned int) /src/gr_face.cpp:59
    #4 0x7fc9fadd9f79 in gr_make_face_with_ops /src/gr_face.cpp:89
    #5 0x7fc9fadd9f79 in gr_make_file_face /src/gr_face.cpp:242
    #6 0x48ed05 in Parameters::testFileFont() const /gr2fonttest/gr2FontTest.cpp:618
    #7 0x49248b in main /gr2fonttest/gr2FontTest.cpp:770
    #8 0x7fc9faa17ec4 (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4)
    #9 0x486c4c in _start (/build/gr2fonttest/gr2fonttest+0x486c4c)

0x60200000c5d8 is located 4 bytes to the right of 4-byte region [0x60200000c5d0,0x60200000c5d4)
allocated by thread T0 here:
    #0 0x46df61 in __interceptor_malloc (/build/gr2fonttest/gr2fonttest+0x46df61)
    #1 0x7fc9faea8313 in unsigned short* graphite2::gralloc<unsigned short>(unsigned long) /src/inc/Main.h:88
    #2 0x7fc9faea8313 in graphite2::Silf::readClassMap(unsigned char const*, unsigned long, unsigned int, graphite2::Error&) /src/Silf.cpp:277
    #3 0x7fc9faea5c24 in graphite2::Silf::readGraphite(unsigned char const*, unsigned long, graphite2::Face&, unsigned int) /src/Silf.cpp:190
    #4 0x7fc9fae3afb8 in graphite2::Face::readGraphite(graphite2::Face::Table const&) /src/Face.cpp:149

SUMMARY: AddressSanitizer: heap-buffer-overflow /src/Silf.cpp:287 graphite2::Silf::readClassMap(unsigned char const*, unsigned long, unsigned int, graphite2::Error&)
Shadow bytes around the buggy address:
  0x0c047fff9860: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9870: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9880: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9890: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff98a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c047fff98b0: fa fa fa fa fa fa fa fa fa fa 04[fa]fa fa 00 04
  0x0c047fff98c0: fa fa 01 fa fa fa 00 04 fa fa fd fa fa fa fd fd
  0x0c047fff98d0: fa fa fd fd fa fa fd fd fa fa 00 00 fa fa 00 00
  0x0c047fff98e0: fa fa fd fd fa fa 00 00 fa fa 00 00 fa fa 00 00
  0x0c047fff98f0: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00
  0x0c047fff9900: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Contiguous container OOB:fc
  ASan internal:           fe
==23318==ABORTING


Note that this is on graphite2 trunk and without OTS in front of it. We tested this particular file in Firefox and it is rejected by OTS with:

glyf: Glyph too short 138
glyf: Failed to parse glyph 28
glyf: failed to parse table


However, according to cdiehl that doesn't necessarily mean that the bug cannot be reached through OTS (e.g. by fixing up the testcase enough to make it through). Marking s-s until we confirmed that this bug cannot be reached/exploited with OTS enabled.
Attached file Testcase
Flags: needinfo?(martin_hosken)
Fixed upstream
Flags: needinfo?(martin_hosken)
Keywords: sec-moderate
Whiteboard: sec-high+ without OTS
Group: core-security → gfx-core-security
Depends on: 1207207
Fixed in central
Whiteboard: sec-high+ without OTS → sec-high+ without OTS [gfx-noted]
(In reply to martin_hosken from comment #3)
> Fixed in central

Can we mark this bug fixed ?
No longer depends on: 1207207
Fixed by bug 1200098.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Group: gfx-core-security → core-security-release
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: