Menu

#10 engine crashes if Font::getTable() returns length = 0

closed
None
5
2007-07-17
2007-07-17
No

According to both the documentation (V2_Engine_Interface.odt, §3.1)
and the comments in Font.h, the getTable() method is allowed to set
the table length output parameter to zero (while returning the
correct table pointer), if it cannot readily determine the actual
table size.

However, if a Font class actually does this, the engine crashes; for
example:

----------------------------------------------------------
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000000

Thread 0 Crashed:
0 libgraphite.3.dylib 0x010283d8 gr::EngineState::InitializeStreams
(gr::GrTableManager*, gr::GrCharStream*, int, unsigned char*, bool,
int*) + 772 (GrTableManager.cpp:1560)
1 libgraphite.3.dylib 0x01029fc4 gr::GrTableManager::Run
(gr::Segment*, gr::Font*, gr::GrCharStream*, gr::IGrJustifier*, int,
gr::LayoutEnvironment&, int, float, float, bool, bool, int, bool,
bool, int, int, gr::tagSegEnd) + 596 (GrTableManager.cpp:399)
2 libgraphite.3.dylib 0x01014bf4 gr::GrEngine::MakeSegment
(gr::Segment*, gr::Font*, gr::ITextSource*, gr::IGrJustifier*,
gr::LayoutEnvironment&, int, int, float, bool, bool, float,
gr::tagSegEnd) + 932 (GrEngine.cpp:692)
3 libgraphite.3.dylib 0x0100b774 gr::Font::RenderLineFillSegment
(gr::Segment*, gr::ITextSource*, gr::LayoutEnvironment&, unsigned,
unsigned, float, bool) + 148 (Font.cpp:397)
4 libgraphite.3.dylib 0x0102f9ac
gr::LineFillSegment::LineFillSegment[in-charge](gr::Font*,
gr::ITextSource*, gr::LayoutEnvironment*, unsigned, unsigned, float,
bool) + 208 (Segment.cpp:148)
5 regression-test 0x00003724 RunOneTestCase(TestCase*,
gr::Segment*, gr::Segment**, RtTextSrc**) + 1484 (RegressionTest.cpp:
235)
6 regression-test 0x00004950 RunTests(int, TestCase*) + 956
(RegressionTest.cpp:148)
7 regression-test 0x00004d78 main + 876 (RegressionTest.cpp:110)
8 regression-test 0x00001fec _start + 340 (crt.c:272)
9 regression-test 0x00001e94 start + 60
----------------------------------------------------------

This happened first with my own Font subclass, but then I tried it
using the regression-test tool, after modifying FileFont.cpp so as to
return zero instead of the actual table size. So it seems that the
option to return zero for an unknown table size is broken.

JK

Discussion

  • Sharon Correll

    Sharon Correll - 2007-07-17

    Logged In: YES
    user_id=637940
    Originator: YES

    Fixed. The engine will now simply create a temporary pointer to the crucial tables (cmap and name in particular) and then update the pointers as necessary when creating a segment.

     
  • Sharon Correll

    Sharon Correll - 2007-07-17
    • assigned_to: nobody --> sharoncorrell
    • status: open --> closed
     

Log in to post a comment.