summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-11-14 19:03:04 +0100
committerwm4 <wm4@nowhere>2014-11-14 19:03:04 +0100
commitdc4544a0d493d79de3766f267df893d377fa148a (patch)
tree59c44017bd7680e06458bb746130d52481ae4091
parent2fe3ce09af3a4e399f3758fe15fc946c0fa5ef50 (diff)
downloadlibass-dc4544a0d493d79de3766f267df893d377fa148a.tar.bz2
libass-dc4544a0d493d79de3766f267df893d377fa148a.tar.xz
Fix recently introduced overflow check (again)
-rw-r--r--libass/ass_bitmap.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/libass/ass_bitmap.c b/libass/ass_bitmap.c
index aadce59..11ca1e8 100644
--- a/libass/ass_bitmap.c
+++ b/libass/ass_bitmap.c
@@ -124,20 +124,16 @@ static bool generate_tables(ASS_SynthPriv *priv, double radius)
static bool resize_tmp(ASS_SynthPriv *priv, int w, int h)
{
- if ((w - 1) > SIZE_MAX / sizeof(unsigned) / h)
+ if (w >= INT_MAX || (w + 1) > SIZE_MAX / 2 / sizeof(unsigned) / h)
return false;
size_t needed = sizeof(unsigned) * (w + 1) * h;
if (priv->tmp && priv->tmp_allocated >= needed)
return true;
- if (needed >= SIZE_MAX / 2)
- return false;
ass_aligned_free(priv->tmp);
priv->tmp_allocated = FFMAX(needed, priv->tmp_allocated * 2);
priv->tmp = ass_aligned_alloc(32, priv->tmp_allocated);
- if (!priv->tmp)
- return false;
- return true;
+ return !!priv->tmp;
}
void ass_synth_blur(ASS_SynthPriv *priv_blur, int opaque_box, int be,