]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
archive_ppmd7.c: avoid possible integer overflow (security)
authorMartin Matuska <martin@matuska.org>
Tue, 14 Jan 2020 15:35:31 +0000 (16:35 +0100)
committerMartin Matuska <martin@matuska.org>
Tue, 14 Jan 2020 16:00:03 +0000 (17:00 +0100)
Found by LGTM.com code analysis

libarchive/archive_ppmd7.c

index d0bacc68cd7c653cbdd78f0b0f4a19851fa06b17..4029395b4c7f456816538e3b9a40ce092e85e406 100644 (file)
@@ -1000,7 +1000,7 @@ static void RangeEnc_ShiftLow(CPpmd7z_RangeEnc *p)
 
 static void RangeEnc_Encode(CPpmd7z_RangeEnc *p, UInt32 start, UInt32 size, UInt32 total)
 {
-  p->Low += start * (p->Range /= total);
+  p->Low += (UInt64)start * (UInt64)(p->Range /= total);
   p->Range *= size;
   while (p->Range < kTopValue)
   {