← Commit list

982c44d03

Denys Vlasenko
Denys Vlasenko
2018-02-03
SUCCESS Duration: 144s

Subject

bzip2: rewrite bit of code which depends on integer overflow

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

archival/libarchive/bz/compress.c+5 -5
@@ -297,7 +297,7 @@ void sendMTFValues(EState* s)
// 200..599 = 3
// 600..1199 = 4
// 1200..2399 = 5
- // else 6
+ // 2400..99999 = 6
nGroups = 2;
nGroups += (s->nMTF >= 200);
nGroups += (s->nMTF >= 600);
@@ -317,12 +317,12 @@ void sendMTFValues(EState* s)
unsigned tFreq, aFreq;
tFreq = remF / nPart;
- ge = gs - 1; //underflows on 1st iteration
+ ge = gs;
aFreq = 0;
- while (aFreq < tFreq && (int)ge < (int)alphaSize-1) {
- ge++;
- aFreq += s->mtfFreq[ge];
+ while (aFreq < tFreq && ge < alphaSize) {
+ aFreq += s->mtfFreq[ge++];
}
+ ge--;
if (ge > gs
&& nPart != nGroups && nPart != 1