mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-18 03:55:19 -04:00
Fix heap overflow access in vorbis decoder with specially crafted ogg file, fixes #591 (Thanks khang06)
This commit is contained in:
parent
ad314a5c55
commit
9ac97942c2
11
src/Vorbis.c
11
src/Vorbis.c
@ -313,17 +313,16 @@ static ReturnCode Codebook_DecodeSetup(struct VorbisState* ctx, struct Codebook*
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
len = Vorbis_ReadBits(ctx, 5) + 1;
|
len = Vorbis_ReadBits(ctx, 5) + 1;
|
||||||
for (entry = 0; entry < c->Entries; entry += runLen) {
|
for (entry = 0; entry < c->Entries;) {
|
||||||
runBits = iLog(c->Entries - entry);
|
runBits = iLog(c->Entries - entry);
|
||||||
runLen = Vorbis_ReadBits(ctx, runBits);
|
runLen = Vorbis_ReadBits(ctx, runBits);
|
||||||
|
|
||||||
for (i = entry; i < entry + runLen; i++) {
|
/* handle corrupted ogg files */
|
||||||
codewordLens[i] = len;
|
if (entry + runLen > c->Entries) return VORBIS_ERR_CODEBOOK_ENTRY;
|
||||||
}
|
|
||||||
|
for (i = 0; i < runLen; i++) { codewordLens[entry++] = len; }
|
||||||
c->NumCodewords[len++] = runLen;
|
c->NumCodewords[len++] = runLen;
|
||||||
if (entry > c->Entries) return VORBIS_ERR_CODEBOOK_ENTRY;
|
|
||||||
}
|
}
|
||||||
entry = c->Entries;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
c->TotalCodewords = entry;
|
c->TotalCodewords = entry;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user