[hdmx] Fix sanitize()
This commit is contained in:
parent
84d4bb91ce
commit
c2e4713b5b
|
@ -178,27 +178,18 @@ struct hdmx
|
||||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||||
{
|
{
|
||||||
TRACE_SANITIZE (this);
|
TRACE_SANITIZE (this);
|
||||||
if (unlikely (!c->check_struct (this) || version != 0))
|
return_trace (c->check_struct (this) && version == 0 &&
|
||||||
return_trace (false);
|
!_hb_unsigned_int_mul_overflows (num_records, size_device_record) &&
|
||||||
if (unlikely (!c->check_range (this, get_size())))
|
c->check_range (this, get_size()));
|
||||||
return_trace (false);
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < num_records; i++)
|
|
||||||
{
|
|
||||||
if (unlikely (!records[i].sanitize (c, size_device_record)))
|
|
||||||
return_trace (false);
|
|
||||||
}
|
|
||||||
return_trace (true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
protected:
|
||||||
HBUINT16 version; /* Table version number (0) */
|
HBUINT16 version; /* Table version number (0) */
|
||||||
HBUINT16 num_records; /* Number of device records. */
|
HBUINT16 num_records; /* Number of device records. */
|
||||||
HBUINT32 size_device_record; /* Size of a device record, 32-bit aligned. */
|
HBUINT32 size_device_record; /* Size of a device record, 32-bit aligned. */
|
||||||
private:
|
HBUINT8 data[VAR]; /* Array of device records. */
|
||||||
DeviceRecord records[VAR]; /* Array of device records. */
|
public:
|
||||||
public:
|
DEFINE_SIZE_ARRAY (8, data);
|
||||||
DEFINE_SIZE_MIN (8);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace OT */
|
} /* namespace OT */
|
||||||
|
|
Loading…
Reference in New Issue