Check to avoid overflows
This commit is contained in:
parent
d70afb1e5a
commit
b28c282585
|
@ -189,9 +189,12 @@ struct hb_sanitize_context_t :
|
||||||
void start_processing ()
|
void start_processing ()
|
||||||
{
|
{
|
||||||
reset_object ();
|
reset_object ();
|
||||||
this->max_ops = hb_min (hb_max ((unsigned int) (this->end - this->start) * HB_SANITIZE_MAX_OPS_FACTOR,
|
if (unlikely (hb_unsigned_mul_overflows (this->end - this->start, HB_SANITIZE_MAX_OPS_FACTOR)))
|
||||||
(unsigned) HB_SANITIZE_MAX_OPS_MIN),
|
this->max_ops = HB_SANITIZE_MAX_OPS_MAX;
|
||||||
(unsigned) HB_SANITIZE_MAX_OPS_MAX);
|
else
|
||||||
|
this->max_ops = hb_min (hb_max ((unsigned int) (this->end - this->start) * HB_SANITIZE_MAX_OPS_FACTOR,
|
||||||
|
(unsigned) HB_SANITIZE_MAX_OPS_MIN),
|
||||||
|
(unsigned) HB_SANITIZE_MAX_OPS_MAX);
|
||||||
this->edit_count = 0;
|
this->edit_count = 0;
|
||||||
this->debug_depth = 0;
|
this->debug_depth = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue