diff options
author | Grigori Goronzy <greg@chown.ath.cx> | 2017-05-10 13:39:57 +0200 |
---|---|---|
committer | Grigori Goronzy <greg@chown.ath.cx> | 2017-05-10 13:45:31 +0200 |
commit | 4cf8d6bb3e6b75f8215b69f697b6b5c05b1c1dd2 (patch) | |
tree | 9943559c94bf98cc1c4529cf3de8751de549b93b /libass | |
parent | f2832a0134a953dd7cef02e7c741bcaffdde4974 (diff) | |
download | libass-4cf8d6bb3e6b75f8215b69f697b6b5c05b1c1dd2.tar.bz2 libass-4cf8d6bb3e6b75f8215b69f697b6b5c05b1c1dd2.tar.xz |
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.
Diffstat (limited to 'libass')
-rw-r--r-- | libass/ass.c | 4 |
1 files changed, 2 insertions, 2 deletions
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); } |