diff options
author | Oleg Oshmyan <chortos@inbox.lv> | 2017-02-04 01:35:54 +0200 |
---|---|---|
committer | Oleg Oshmyan <chortos@inbox.lv> | 2020-10-18 05:01:31 +0300 |
commit | 894e1d51cf252a3a38743b2828f190af17d0d31a (patch) | |
tree | fe776b55e9be3fdddd67a459526d5196f6ff1796 | |
parent | 7913e4a64c704a3b82719d70920b5b153b43d254 (diff) | |
download | libass-894e1d51cf252a3a38743b2828f190af17d0d31a.tar.bz2 libass-894e1d51cf252a3a38743b2828f190af17d0d31a.tar.xz |
ass_lazy_track_init: avoid integer overflow in multiply-divide
This is incompatible with VSFilter, so maybe we
should later change this to use uint32_t instead.
This fixes the multiply-divide if the result fits in int,
but `PlayResX = PlayResY * 4LL / 3;` still overflows if PlayResY
is close to INT_MAX. This should be addressed in a separate commit.
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=533.
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=603.
-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 811a9a7..abfbe7a 100644 --- a/libass/ass.c +++ b/libass/ass.c @@ -1498,7 +1498,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 = FFMAX(1, track->PlayResX * 3 / 4); + track->PlayResY = FFMAX(1, track->PlayResX * 3LL / 4); ass_msg(lib, MSGL_WARN, "PlayResY undefined, setting to %d", track->PlayResY); } else if (track->PlayResX <= 0 && track->PlayResY == 1024) { @@ -1506,7 +1506,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 = FFMAX(1, track->PlayResY * 4 / 3); + track->PlayResX = FFMAX(1, track->PlayResY * 4LL / 3); ass_msg(lib, MSGL_WARN, "PlayResX undefined, setting to %d", track->PlayResX); } |