[BASE] Sanitize and get_min_max fixups

Seems to work now.
This commit is contained in:
Behdad Esfahbod 2023-05-19 14:22:13 -06:00
parent 02e0e9394b
commit 6996e64f72

View file

@ -170,8 +170,8 @@ struct FeatMinMaxRecord
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
minCoord.sanitize (c, this) &&
maxCoord.sanitize (c, this)));
minCoord.sanitize (c, base) &&
maxCoord.sanitize (c, base)));
}
protected:
@ -187,7 +187,6 @@ struct FeatMinMaxRecord
* of MinMax table (may be NULL) */
public:
DEFINE_SIZE_STATIC (8);
};
struct MinMax
@ -274,7 +273,7 @@ struct BaseLangSysRecord
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
minMax.sanitize (c, this)));
minMax.sanitize (c, base)));
}
protected:
@ -297,7 +296,8 @@ struct BaseScript
const BaseCoord &get_base_coord (int baseline_tag_index) const
{ return (this+baseValues).get_base_coord (baseline_tag_index); }
bool has_data () const { return baseValues; }
bool has_values () const { return baseValues; }
bool has_min_max () const { return defaultMinMax; /* TODO What if only per-language is present? */ }
bool sanitize (hb_sanitize_context_t *c) const
{
@ -383,7 +383,7 @@ struct Axis
const BaseCoord **coord) const
{
const BaseScript &base_script = (this+baseScriptList).get_base_script (script_tag);
if (!base_script.has_data ())
if (!base_script.has_values ())
{
*coord = nullptr;
return false;
@ -410,7 +410,7 @@ struct Axis
const BaseCoord **max_coord) const
{
const BaseScript &base_script = (this+baseScriptList).get_base_script (script_tag);
if (!base_script.has_data ())
if (!base_script.has_min_max ())
{
*min_coord = *max_coord = nullptr;
return false;
@ -425,8 +425,8 @@ struct Axis
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
(this+baseTagList).sanitize (c) &&
(this+baseScriptList).sanitize (c)));
baseTagList.sanitize (c, this) &&
baseScriptList.sanitize (c, this)));
}
protected: