diff options
author | Oleg Oshmyan <chortos@inbox.lv> | 2017-02-03 15:13:48 +0200 |
---|---|---|
committer | Oleg Oshmyan <chortos@inbox.lv> | 2020-10-18 05:01:31 +0300 |
commit | 3250a3b784f3b76d476943ab9ffd880c720ecb10 (patch) | |
tree | 00a35cdb20644f7696bc6f9aa246aca4d3f01a23 /libass/ass_strtod.c | |
parent | 59349a70589f3cd97a608fee67da5d27b9944242 (diff) | |
download | libass-3250a3b784f3b76d476943ab9ffd880c720ecb10.tar.bz2 libass-3250a3b784f3b76d476943ab9ffd880c720ecb10.tar.xz |
Prevent int overflow where unsigned wraparound is desired
On exotic (or future) platforms, types such as size_t and uint32_t may
be promoted to int, which allows multiplication, addition and left-shift
operations on these types to overflow (and produce undefined behavior).
To avoid this, make sure that the affected arithmetic operators convert
any promoted operands to unsigned int by the usual arithmetic conversions.
Diffstat (limited to 'libass/ass_strtod.c')
-rw-r--r-- | libass/ass_strtod.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libass/ass_strtod.c b/libass/ass_strtod.c index 3b9ec3f..47302a8 100644 --- a/libass/ass_strtod.c +++ b/libass/ass_strtod.c @@ -259,7 +259,7 @@ ass_strtod( } else if (exp > ((size_t) -1 - (*p - '0')) / 10) { expWraparound = 1; } - exp = exp * 10 + (*p - '0'); + exp = exp * 10u + (*p - '0'); p += 1; } if (expSign == fracExpSign) { |