Closed Bug 1194006 Opened 4 years ago Closed 4 years ago

Crash [@ unsigned long be::_peek]

Categories

(Core :: Graphics: Text, defect, critical)

x86_64
Linux
defect
Not set
critical

Tracking

()

RESOLVED FIXED
Tracking Status
firefox42 --- wontfix
firefox43 --- fixed
firefox44 --- fixed

People

(Reporter: decoder, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: crash, sec-moderate, testcase, Whiteboard: sec-high+ without OTS [gfx-noted][adv-main43+][post-critsmash-triage])

Crash Data

Attachments

(1 file)

45.56 KB, application/octet-stream
Details
The attached testcase crashes on graphite2 revision fa8d4398dded (run through the gr2fonttest command line utility).

Backtrace:

==19692==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000efd1 at pc 0x7fcc28c97e82 bp 0x7fff0c7d2af0 sp 0x7fff0c7d2ae8
READ of size 1 at 0x60200000efd1 thread T0
    #0 0x7fcc28c97e81 in unsigned long be::_peek<1>(unsigned char const*) /src/inc/Endian.h:77
    #1 0x7fcc28c97e81 in unsigned long be::_peek<2>(unsigned char const*) /src/inc/Endian.h:50
    #2 0x7fcc28c97e81 in unsigned long be::_peek<4>(unsigned char const*) /src/inc/Endian.h:50
    #3 0x7fcc28c97e81 in unsigned int be::peek<unsigned int>(void const*) /src/inc/Endian.h:55
    #4 0x7fcc28c97e81 in graphite2::Face::Table::Table(graphite2::Face const&, graphite2::TtfUtil::Tag, unsigned int) /src/Face.cpp:284
    #5 0x7fcc28caf5df in graphite2::GlyphCache::Loader::Loader(graphite2::Face const&, bool) /src/GlyphCache.cpp:248
    #6 0x7fcc28ca6211 in graphite2::GlyphCache::GlyphCache(graphite2::Face const&, unsigned int) /src/GlyphCache.cpp:123
    #7 0x7fcc28c93304 in graphite2::Face::readGlyphs(unsigned int) /src/Face.cpp:98
    #8 0x7fcc28c30a7b in (anonymous namespace)::load_face(graphite2::Face&, unsigned int) /src/gr_face.cpp:54
    #9 0x7fcc28c33f79 in gr_make_face_with_ops /src/gr_face.cpp:89
    #10 0x7fcc28c33f79 in gr_make_file_face /src/gr_face.cpp:242
    #11 0x48ed05 in Parameters::testFileFont() const /gr2fonttest/gr2FontTest.cpp:618
    #12 0x49248b in main /gr2fonttest/gr2FontTest.cpp:770
    #13 0x7fcc28871ec4 (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4)
    #14 0x486c4c in _start (/build/gr2fonttest/gr2fonttest+0x486c4c)

0x60200000efd1 is located 0 bytes to the right of 1-byte region [0x60200000efd0,0x60200000efd1)
allocated by thread T0 here:
    #0 0x46df61 in __interceptor_malloc (/build/gr2fonttest/gr2fonttest+0x46df61)
    #1 0x7fcc28d25bfe in graphite2::FileFace::get_table_fn(void const*, unsigned int, unsigned long*) /src/FileFace.cpp:90
    #2 0x7fcc28c9779f in graphite2::Face::Table::Table(graphite2::Face const&, graphite2::TtfUtil::Tag, unsigned int) /src/Face.cpp:274
    #3 0x7fcc28caf5df in graphite2::GlyphCache::Loader::Loader(graphite2::Face const&, bool) /src/GlyphCache.cpp:248
    #4 0x7fcc28ca6211 in graphite2::GlyphCache::GlyphCache(graphite2::Face const&, unsigned int) /src/GlyphCache.cpp:123
    #5 0x7fcc28c93304 in graphite2::Face::readGlyphs(unsigned int) /src/Face.cpp:98

SUMMARY: AddressSanitizer: heap-buffer-overflow /src/inc/Endian.h:77 unsigned long be::_peek<1>(unsigned char const*)
Shadow bytes around the buggy address:
  0x0c047fff9da0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9db0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9dc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9dd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9de0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c047fff9df0: fa fa fa fa fa fa fa fa fa fa[01]fa fa fa 00 04
  0x0c047fff9e00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9e10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9e20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9e30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9e40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
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
==19692==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: invalid table offset

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
Whiteboard: sec-high+ without OTS → sec-high+ without OTS [gfx-noted]
fixed in central (and aurora)
Fixed by bug 1200098.
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Depends on: 1200098
No longer depends on: 1207207
Group: gfx-core-security → core-security-release
Whiteboard: sec-high+ without OTS [gfx-noted] → sec-high+ without OTS [gfx-noted][adv-main43+]
Whiteboard: sec-high+ without OTS [gfx-noted][adv-main43+] → sec-high+ without OTS [gfx-noted][adv-main43+][post-critsmash-triage]
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.