[Date Prev][Date Next] [Chronological] [Thread] [Top]

_ucprop_load in liblunicode/ucdata.c (ITS#712)



Full_Name: Randy Kunkee
Version: 2.0
OS: Alpha OSF 4.0e
URL: 
Submission from: (NULL) (206.109.5.138)


_ucprop_load uses the following structure to load data from a binary data
file:

typedef struct {
    unsigned short bom;
    unsigned short cnt;
    union {
        unsigned long bytes;
        unsigned short len[2];
    } size;
} _ucheader_t;

The design does not appear to be portable to 64 bit architectures,
at least not mine.  A long is 64 bits, and bom.size.bytes winds up
being very large:

Breakpoint 1, _ucprop_load (
    paths=0x14000f6a8 "/server/local2/share/openldap/ucdata", reload=0)
    at ucdata.c:147
147         fread((char *) &hdr, sizeof(_ucheader_t), 1, in);
(gdb) n
149         if (hdr.bom == 0xfffe) {
(gdb) n
154         if ((_ucprop_size = hdr.cnt) == 0) {
(gdb) print hdr
$1 = {bom = 65279, cnt = 49, size = {bytes = 52354345668182016, len = {0, 0}}}
(gdb)