From c431edb759dcf0deade654581f36e759e429b994 Mon Sep 17 00:00:00 2001 From: Dirk Farin Date: Mon, 30 Oct 2023 21:13:09 +0100 Subject: [PATCH] fix integer overflow --- libheif/box.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libheif/box.cc b/libheif/box.cc index 4c0a85afe4..e752ac4807 100644 --- a/libheif/box.cc +++ b/libheif/box.cc @@ -85,7 +85,7 @@ Fraction::Fraction(int64_t num, int64_t den) Fraction Fraction::operator+(const Fraction& b) const { if (denominator == b.denominator) { - int64_t n = numerator + b.numerator; + int64_t n = int64_t{numerator} + b.numerator; int64_t d = denominator; return Fraction{n,d}; } @@ -99,7 +99,7 @@ Fraction Fraction::operator+(const Fraction& b) const Fraction Fraction::operator-(const Fraction& b) const { if (denominator == b.denominator) { - int64_t n = numerator - b.numerator; + int64_t n = int64_t{numerator} - b.numerator; int64_t d = denominator; return Fraction{n,d}; }