Menu

#44 Compiler Bus Errors on Sparc

open
compiler (8)
5
2012-10-31
2012-01-29
No

When run under Solaris 10 on sparc architecture (V8, i.e. 32-bit), the compiler crashes with accesses to unaligned 16-bit integers.

The problem occurs because UTF-16 strings in the TrueType name table are not necessarily located at even allocations and because 16-bit data in the point position data in the glyf table is not necessarily aligned.

Two of the crashes are caused by attempting to copy unaligned UTF-16strings in GrcManager::BuildFontNames in OutputToFont.cpp. As the length supplied is already in bytes, it makes sense to use memcpy rather than utf16ncpy.

For function SwapWString in TtfUtil.cpp, the simplest solution seems to be to explicltly swap the bytes inline. For the first function GlyfPoints in TtfUtil, the simplest solution seems to be to read the value in byte by byte and then assemble as a 16-bit quantity.

I attach my corrections relative to Subversion release 1139, which I have identified as corresponding to Version 4.1.0 for Unix, in file patch_1139.dif.

I tested the changes by applying the conversions to a moderately complex font. While the resulting font was not identical (mutatis mutandis) to the one generated on Ubuntu on an i686 PC, for a pair of pseudoglyph IDs were swapped, with various knock-on effects, including table size, I detected no difference in the rendering of the test cases for my font.

Discussion

  • Richard Wordingham

    Patch for my corrections to the bug.

     
  • Richard Wordingham

    Note: The test renderings were made use LibreOffice Version 3.3.2.

     
  • Martin Hosken

    Martin Hosken - 2012-10-31
    • labels: --> compiler
    • assigned_to: nobody --> sharoncorrell
     

Log in to post a comment.