From 4cf8d6bb3e6b75f8215b69f697b6b5c05b1c1dd2 Mon Sep 17 00:00:00 2001 From: Grigori Goronzy Date: Wed, 10 May 2017 13:39:57 +0200 Subject: Fix PlayResX/Y calculations Avoid that PlayResY is set to 0 when only PlayResX is specified and set to 1. Setting PlayResY to 0 results in divide-by-zero errors. Also fix PlayResX calculations in case only PlayResY is specified, for completeness. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1474. --- libass/ass.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libass') diff --git a/libass/ass.c b/libass/ass.c index 159391d..c3bc6e5 100644 --- a/libass/ass.c +++ b/libass/ass.c @@ -1345,7 +1345,7 @@ void ass_lazy_track_init(ASS_Library *lib, ASS_Track *track) ass_msg(lib, MSGL_WARN, "PlayResY undefined, setting to %d", track->PlayResY); } else if (track->PlayResY <= 0) { - track->PlayResY = track->PlayResX * 3 / 4; + track->PlayResY = FFMAX(1, track->PlayResX * 3 / 4); ass_msg(lib, MSGL_WARN, "PlayResY undefined, setting to %d", track->PlayResY); } else if (track->PlayResX <= 0 && track->PlayResY == 1024) { @@ -1353,7 +1353,7 @@ void ass_lazy_track_init(ASS_Library *lib, ASS_Track *track) ass_msg(lib, MSGL_WARN, "PlayResX undefined, setting to %d", track->PlayResX); } else if (track->PlayResX <= 0) { - track->PlayResX = track->PlayResY * 4 / 3; + track->PlayResX = FFMAX(1, track->PlayResY * 4 / 3); ass_msg(lib, MSGL_WARN, "PlayResX undefined, setting to %d", track->PlayResX); } -- cgit v1.2.3