Skip to content

timeout in context_apply_lookup #157

@kcc

Description

@kcc

timeout-c7f0b03f12f51efc0702eb48d336e7d4e1d3d252.pdf
Found with libFuzzer.
Run the attached file through the fuzzer target (see #139), it will run at least half hour (maybe forever)
This bug may cause DOS attacks and such, but it also hurts further fuzzing immensely.

The stack trace:

    #5 0x5c8e45 in OT::apply_lookup(OT::hb_apply_context_t*, unsigned int, unsigned int*, unsigned int, OT::LookupRecord const*, unsigned int) src/./hb-ot-layout-gsubgpos-private.hh:969:3
    #6 0x625c63 in OT::context_apply_lookup(OT::hb_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext&) src/./hb-ot-layout-gsubgpos-private.hh:1102:10
    #7 0x625c63 in OT::Rule::apply(OT::hb_apply_context_t*, OT::ContextApplyLookupContext&) const src/./hb-ot-layout-gsubgpos-private.hh:1141
    #8 0x625c63 in OT::RuleSet::apply(OT::hb_apply_context_t*, OT::ContextApplyLookupContext&) const src/./hb-ot-layout-gsubgpos-private.hh:1204
    #9 0x6204ca in OT::ContextFormat1::apply(OT::hb_apply_context_t*) const src/./hb-ot-layout-gsubgpos-private.hh:1290:5
    #10 0x6204ca in bool OT::hb_apply_context_t::dispatch<OT::ContextFormat1>(OT::ContextFormat1 const&) src/./hb-ot-layout-gsubgpos-private.hh:446
    #11 0x6204ca in OT::hb_apply_context_t::return_t OT::Context::dispatch<OT::hb_apply_context_t>(OT::hb_apply_context_t*) const src/./hb-ot-layout-gsubgpos-private.hh:1510
    #12 0x62d7d3 in OT::hb_apply_context_t::return_t OT::PosLookupSubTable::dispatch<OT::hb_apply_context_t>(OT::hb_apply_context_t*, unsigned int) const src/./hb-ot-layout-gpos-table.hh:1417:20
    #13 0x62c7cb in OT::hb_apply_context_t::return_t OT::Lookup::dispatch<OT::PosLookupSubTable, OT::hb_apply_context_t>(OT::hb_apply_context_t*) const src/./hb-ot-layout-common-private.hh:620:40
    #14 0x62c7cb in OT::hb_apply_context_t::return_t OT::PosLookup::dispatch<OT::hb_apply_context_t>(OT::hb_apply_context_t*) const src/./hb-ot-layout-gpos-table.hh:1478
    #15 0x62c7cb in OT::PosLookup::apply_recurse_func(OT::hb_apply_context_t*, unsigned int) src/./hb-ot-layout-gpos-table.hh:1629
    #16 0x5c7ce8 in OT::hb_apply_context_t::recurse(unsigned int) src/./hb-ot-layout-gsubgpos-private.hh:455:16
    #17 0x5c7ce8 in OT::apply_lookup(OT::hb_apply_context_t*, unsigned int, unsigned int*, unsigned int, OT::LookupRecord const*, unsigned int) src/./hb-ot-layout-gsubgpos-private.hh:978
    #18 0x625c63 in OT::context_apply_lookup(OT::hb_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext&) src/./hb-ot-layout-gsubgpos-private.hh:1102:10
    #19 0x625c63 in OT::Rule::apply(OT::hb_apply_context_t*, OT::ContextApplyLookupContext&) const src/./hb-ot-layout-gsubgpos-private.hh:1141
    #20 0x625c63 in OT::RuleSet::apply(OT::hb_apply_context_t*, OT::ContextApplyLookupContext&) const src/./hb-ot-layout-gsubgpos-private.hh:1204
    #21 0x6204ca in OT::ContextFormat1::apply(OT::hb_apply_context_t*) const src/./hb-ot-layout-gsubgpos-private.hh:1290:5
    #22 0x6204ca in bool OT::hb_apply_context_t::dispatch<OT::ContextFormat1>(OT::ContextFormat1 const&) src/./hb-ot-layout-gsubgpos-private.hh:446
    #23 0x6204ca in OT::hb_apply_context_t::return_t OT::Context::dispatch<OT::hb_apply_context_t>(OT::hb_apply_context_t*) const src/./hb-ot-layout-gsubgpos-private.hh:1510
    #24 0x62d7d3 in OT::hb_apply_context_t::return_t OT::PosLookupSubTable::dispatch<OT::hb_apply_context_t>(OT::hb_apply_context_t*, unsigned int) const src/./hb-ot-layout-gpos-table.hh:1417:20
    #25 0x62c7cb in OT::hb_apply_context_t::return_t OT::Lookup::dispatch<OT::PosLookupSubTable, OT::hb_apply_context_t>(OT::hb_apply_context_t*) const src/./hb-ot-layout-common-private.hh:620:40
    #26 0x62c7cb in OT::hb_apply_context_t::return_t OT::PosLookup::dispatch<OT::hb_apply_context_t>(OT::hb_apply_context_t*) const src/./hb-ot-layout-gpos-table.hh:1478
    #27 0x62c7cb in OT::PosLookup::apply_recurse_func(OT::hb_apply_context_t*, unsigned int) src/./hb-ot-layout-gpos-table.hh:1629
    #28 0x5c7ce8 in OT::hb_apply_context_t::recurse(unsigned int) src/./hb-ot-layout-gsubgpos-private.hh:455:16
    #29 0x5c7ce8 in OT::apply_lookup(OT::hb_apply_context_t*, unsigned int, unsigned int*, unsigned int, OT::LookupRecord const*, unsigned int) src/./hb-ot-layout-gsubgpos-private.hh:978
    #30 0x625c63 in OT::context_apply_lookup(OT::hb_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext&) src/./hb-ot-layout-gsubgpos-private.hh:1102:10
    #31 0x625c63 in OT::Rule::apply(OT::hb_apply_context_t*, OT::ContextApplyLookupContext&) const src/./hb-ot-layout-gsubgpos-private.hh:1141
    #32 0x625c63 in OT::RuleSet::apply(OT::hb_apply_context_t*, OT::ContextApplyLookupContext&) const src/./hb-ot-layout-gsubgpos-private.hh:1204
    #33 0x6204ca in OT::ContextFormat1::apply(OT::hb_apply_context_t*) const src/./hb-ot-layout-gsubgpos-private.hh:1290:5
    #34 0x6204ca in bool OT::hb_apply_context_t::dispatch<OT::ContextFormat1>(OT::ContextFormat1 const&) src/./hb-ot-layout-gsubgpos-private.hh:446
    #35 0x6204ca in OT::hb_apply_context_t::return_t OT::Context::dispatch<OT::hb_apply_context_t>(OT::hb_apply_context_t*) const src/./hb-ot-layout-gsubgpos-private.hh:1510
    #36 0x62d7d3 in OT::hb_apply_context_t::return_t OT::PosLookupSubTable::dispatch<OT::hb_apply_context_t>(OT::hb_apply_context_t*, unsigned int) const src/./hb-ot-layout-gpos-table.hh:1417:20
    #37 0x62c7cb in OT::hb_apply_context_t::return_t OT::Lookup::dispatch<OT::PosLookupSubTable, OT::hb_apply_context_t>(OT::hb_apply_context_t*) const src/./hb-ot-layout-common-private.hh:620:40
    #38 0x62c7cb in OT::hb_apply_context_t::return_t OT::PosLookup::dispatch<OT::hb_apply_context_t>(OT::hb_apply_context_t*) const src/./hb-ot-layout-gpos-table.hh:1478
    #39 0x62c7cb in OT::PosLookup::apply_recurse_func(OT::hb_apply_context_t*, unsigned int) src/./hb-ot-layout-gpos-table.hh:1629
    #40 0x5c7ce8 in OT::hb_apply_context_t::recurse(unsigned int) src/./hb-ot-layout-gsubgpos-private.hh:455:16
    #41 0x5c7ce8 in OT::apply_lookup(OT::hb_apply_context_t*, unsigned int, unsigned int*, unsigned int, OT::LookupRecord const*, unsigned int) src/./hb-ot-layout-gsubgpos-private.hh:978
    #42 0x625c63 in OT::context_apply_lookup(OT::hb_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext&) src/./hb-ot-layout-gsubgpos-private.hh:1102:10
    #43 0x625c63 in OT::Rule::apply(OT::hb_apply_context_t*, OT::ContextApplyLookupContext&) const src/./hb-ot-layout-gsubgpos-private.hh:1141
    #44 0x625c63 in OT::RuleSet::apply(OT::hb_apply_context_t*, OT::ContextApplyLookupContext&) const src/./hb-ot-layout-gsubgpos-private.hh:1204
    #45 0x6204ca in OT::ContextFormat1::apply(OT::hb_apply_context_t*) const src/./hb-ot-layout-gsubgpos-private.hh:1290:5
    #46 0x6204ca in bool OT::hb_apply_context_t::dispatch<OT::ContextFormat1>(OT::ContextFormat1 const&) src/./hb-ot-layout-gsubgpos-private.hh:446
    #47 0x6204ca in OT::hb_apply_context_t::return_t OT::Context::dispatch<OT::hb_apply_context_t>(OT::hb_apply_context_t*) const src/./hb-ot-layout-gsubgpos-private.hh:1510
    #48 0x62d7d3 in OT::hb_apply_context_t::return_t OT::PosLookupSubTable::dispatch<OT::hb_apply_context_t>(OT::hb_apply_context_t*, unsigned int) const src/./hb-ot-layout-gpos-table.hh:1417:20
    #49 0x62c7cb in OT::hb_apply_context_t::return_t OT::Lookup::dispatch<OT::PosLookupSubTable, OT::hb_apply_context_t>(OT::hb_apply_context_t*) const src/./hb-ot-layout-common-private.hh:620:40
    #50 0x62c7cb in OT::hb_apply_context_t::return_t OT::PosLookup::dispatch<OT::hb_apply_context_t>(OT::hb_apply_context_t*) const src/./hb-ot-layout-gpos-table.hh:1478
    #51 0x62c7cb in OT::PosLookup::apply_recurse_func(OT::hb_apply_context_t*, unsigned int) src/./hb-ot-layout-gpos-table.hh:1629
    #52 0x5c7ce8 in OT::hb_apply_context_t::recurse(unsigned int) src/./hb-ot-layout-gsubgpos-private.hh:455:16
    #53 0x5c7ce8 in OT::apply_lookup(OT::hb_apply_context_t*, unsigned int, unsigned int*, unsigned int, OT::LookupRecord const*, unsigned int) src/./hb-ot-layout-gsubgpos-private.hh:978
    #54 0x625c63 in OT::context_apply_lookup(OT::hb_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext&) src/./hb-ot-layout-gsubgpos-private.hh:1102:10
    #55 0x625c63 in OT::Rule::apply(OT::hb_apply_context_t*, OT::ContextApplyLookupContext&) const src/./hb-ot-layout-gsubgpos-private.hh:1141
    #56 0x625c63 in OT::RuleSet::apply(OT::hb_apply_context_t*, OT::ContextApplyLookupContext&) const src/./hb-ot-layout-gsubgpos-private.hh:1204
    #57 0x6204ca in OT::ContextFormat1::apply(OT::hb_apply_context_t*) const src/./hb-ot-layout-gsubgpos-private.hh:1290:5
    #58 0x6204ca in bool OT::hb_apply_context_t::dispatch<OT::ContextFormat1>(OT::ContextFormat1 const&) src/./hb-ot-layout-gsubgpos-private.hh:446
    #59 0x6204ca in OT::hb_apply_context_t::return_t OT::Context::dispatch<OT::hb_apply_context_t>(OT::hb_apply_context_t*) const src/./hb-ot-layout-gsubgpos-private.hh:1510
    #60 0x62d7d3 in OT::hb_apply_context_t::return_t OT::PosLookupSubTable::dispatch<OT::hb_apply_context_t>(OT::hb_apply_context_t*, unsigned int) const src/./hb-ot-layout-gpos-table.hh:1417:20
    #61 0x62c7cb in OT::hb_apply_context_t::return_t OT::Lookup::dispatch<OT::PosLookupSubTable, OT::hb_apply_context_t>(OT::hb_apply_context_t*) const src/./hb-ot-layout-common-private.hh:620:40
    #62 0x62c7cb in OT::hb_apply_context_t::return_t OT::PosLookup::dispatch<OT::hb_apply_context_t>(OT::hb_apply_context_t*) const src/./hb-ot-layout-gpos-table.hh:1478
    #63 0x62c7cb in OT::PosLookup::apply_recurse_func(OT::hb_apply_context_t*, unsigned int) src/./hb-ot-layout-gpos-table.hh:1629
    #64 0x5c7ce8 in OT::hb_apply_context_t::recurse(unsigned int) src/./hb-ot-layout-gsubgpos-private.hh:455:16
    #65 0x5c7ce8 in OT::apply_lookup(OT::hb_apply_context_t*, unsigned int, unsigned int*, unsigned int, OT::LookupRecord const*, unsigned int) src/./hb-ot-layout-gsubgpos-private.hh:978
    #66 0x625c63 in OT::context_apply_lookup(OT::hb_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext&) src/./hb-ot-layout-gsubgpos-private.hh:1102:10
    #67 0x625c63 in OT::Rule::apply(OT::hb_apply_context_t*, OT::ContextApplyLookupContext&) const src/./hb-ot-layout-gsubgpos-private.hh:1141
    #68 0x625c63 in OT::RuleSet::apply(OT::hb_apply_context_t*, OT::ContextApplyLookupContext&) const src/./hb-ot-layout-gsubgpos-private.hh:1204
    #69 0x6204ca in OT::ContextFormat1::apply(OT::hb_apply_context_t*) const src/./hb-ot-layout-gsubgpos-private.hh:1290:5
    #70 0x6204ca in bool OT::hb_apply_context_t::dispatch<OT::ContextFormat1>(OT::ContextFormat1 const&) src/./hb-ot-layout-gsubgpos-private.hh:446
    #71 0x6204ca in OT::hb_apply_context_t::return_t OT::Context::dispatch<OT::hb_apply_context_t>(OT::hb_apply_context_t*) const src/./hb-ot-layout-gsubgpos-private.hh:1510
    #72 0x62d7d3 in OT::hb_apply_context_t::return_t OT::PosLookupSubTable::dispatch<OT::hb_apply_context_t>(OT::hb_apply_context_t*, unsigned int) const src/./hb-ot-layout-gpos-table.hh:1417:20
    #73 0x62c7cb in OT::hb_apply_context_t::return_t OT::Lookup::dispatch<OT::PosLookupSubTable, OT::hb_apply_context_t>(OT::hb_apply_context_t*) const src/./hb-ot-layout-common-private.hh:620:40
    #74 0x62c7cb in OT::hb_apply_context_t::return_t OT::PosLookup::dispatch<OT::hb_apply_context_t>(OT::hb_apply_context_t*) const src/./hb-ot-layout-gpos-table.hh:1478
    #75 0x62c7cb in OT::PosLookup::apply_recurse_func(OT::hb_apply_context_t*, unsigned int) src/./hb-ot-layout-gpos-table.hh:1629
    #76 0x5c7ce8 in OT::hb_apply_context_t::recurse(unsigned int) src/./hb-ot-layout-gsubgpos-private.hh:455:16
    #77 0x5c7ce8 in OT::apply_lookup(OT::hb_apply_context_t*, unsigned int, unsigned int*, unsigned int, OT::LookupRecord const*, unsigned int) src/./hb-ot-layout-gsubgpos-private.hh:978
    #78 0x625c63 in OT::context_apply_lookup(OT::hb_apply_context_t*, unsigned int, OT::IntType<unsigned short, 2u> const*, unsigned int, OT::LookupRecord const*, OT::ContextApplyLookupContext&) src/./hb-ot-layout-gsubgpos-private.hh:1102:10
    #79 0x625c63 in OT::Rule::apply(OT::hb_apply_context_t*, OT::ContextApplyLookupContext&) const src/./hb-ot-layout-gsubgpos-private.hh:1141
    #80 0x625c63 in OT::RuleSet::apply(OT::hb_apply_context_t*, OT::ContextApplyLookupContext&) const src/./hb-ot-layout-gsubgpos-private.hh:1204
    #81 0x6204ca in OT::ContextFormat1::apply(OT::hb_apply_context_t*) const src/./hb-ot-layout-gsubgpos-private.hh:1290:5
    #82 0x6204ca in bool OT::hb_apply_context_t::dispatch<OT::ContextFormat1>(OT::ContextFormat1 const&) src/./hb-ot-layout-gsubgpos-private.hh:446
    #83 0x6204ca in OT::hb_apply_context_t::return_t OT::Context::dispatch<OT::hb_apply_context_t>(OT::hb_apply_context_t*) const src/./hb-ot-layout-gsubgpos-private.hh:1510
    #84 0x62d7d3 in OT::hb_apply_context_t::return_t OT::PosLookupSubTable::dispatch<OT::hb_apply_context_t>(OT::hb_apply_context_t*, unsigned int) const src/./hb-ot-layout-gpos-table.hh:1417:20
    #85 0x5d22f5 in OT::hb_apply_context_t::return_t OT::Lookup::dispatch<OT::PosLookupSubTable, OT::hb_apply_context_t>(OT::hb_apply_context_t*) const src/./hb-ot-layout-common-private.hh:620:40
    #86 0x5d22f5 in OT::hb_apply_context_t::return_t OT::PosLookup::dispatch<OT::hb_apply_context_t>(OT::hb_apply_context_t*) const src/./hb-ot-layout-gpos-table.hh:1478
    #87 0x5d22f5 in OT::PosLookup::apply(OT::hb_apply_context_t*) const src/./hb-ot-layout-gpos-table.hh:1455
    #88 0x5d22f5 in _ZL13apply_forwardIN2OT9PosLookupEEbPNS0_18hb_apply_context_tERKT_RK33hb_ot_layout_lookup_accelerator_t src/hb-ot-layout.cc:898
    #89 0x5d22f5 in _ZL12apply_stringI9GPOSProxyEvPN2OT18hb_apply_context_tERKNT_6LookupERK33hb_ot_layout_lookup_accelerator_t src/hb-ot-layout.cc:976
    #90 0x5d22f5 in void hb_ot_map_t::apply<GPOSProxy>(GPOSProxy const&, hb_ot_shape_plan_t const*, hb_font_t*, hb_buffer_t*) const src/hb-ot-layout.cc:1027
    #91 0x5c07cd in hb_ot_map_t::position(hb_ot_shape_plan_t const*, hb_font_t*, hb_buffer_t*) const src/hb-ot-layout.cc:1049:3
    #92 0x5264d1 in hb_ot_shape_plan_t::position(hb_font_t*, hb_buffer_t*) const src/./hb-ot-shape-private.hh:60:71
    #93 0x5264d1 in hb_ot_position_complex(hb_ot_shape_context_t*) src/hb-ot-shape.cc:715
    #94 0x5264d1 in hb_ot_position(hb_ot_shape_context_t*) src/hb-ot-shape.cc:754
    #95 0x5264d1 in hb_ot_shape_internal(hb_ot_shape_context_t*) src/hb-ot-shape.cc:796
    #96 0x5264d1 in _hb_ot_shape src/hb-ot-shape.cc:816
    #97 0x50bb8c in hb_shape_plan_execute src/./hb-shaper-list.hh:43:1
    #98 0x509570 in hb_shape_full src/hb-shape.cc:375:19
    #99 0x509570 in hb_shape src/hb-shape.cc:405
    #100 0x4d6936 in LLVMFuzzerTestOneInput 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions