static bool resize_tmp(ASS_SynthPriv *priv, int w, int h)
{
- if (w >= INT_MAX || (w + 1) > SIZE_MAX / 2 / sizeof(unsigned) / h)
+ if (w >= INT_MAX || (w + 1) > SIZE_MAX / 2 / sizeof(unsigned) / FFMAX(h, 1))
return false;
size_t needed = sizeof(unsigned) * (w + 1) * h;
if (priv->tmp && priv->tmp_allocated >= needed)
{
blur_radius *= 2;
int bbord = be > 0 ? sqrt(2 * be) : 0;
- int gbord = blur_radius > 0.0 ? FFMAX(blur_radius + 1, INT_MAX) : 0;
+ int gbord = blur_radius > 0.0 ? FFMIN(blur_radius + 1, INT_MAX) : 0;
int bord = FFMAX(bbord, gbord);
if (bord == 0 && (shadow_offset.x || shadow_offset.y))
bord = 1;