mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 11:35:08 -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 {
|
||||
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);
|
||||
runLen = Vorbis_ReadBits(ctx, runBits);
|
||||
|
||||
for (i = entry; i < entry + runLen; i++) {
|
||||
codewordLens[i] = len;
|
||||
}
|
||||
/* handle corrupted ogg files */
|
||||
if (entry + runLen > c->Entries) return VORBIS_ERR_CODEBOOK_ENTRY;
|
||||
|
||||
for (i = 0; i < runLen; i++) { codewordLens[entry++] = len; }
|
||||
c->NumCodewords[len++] = runLen;
|
||||
if (entry > c->Entries) return VORBIS_ERR_CODEBOOK_ENTRY;
|
||||
}
|
||||
entry = c->Entries;
|
||||
}
|
||||
|
||||
c->TotalCodewords = entry;
|
||||
|
Loading…
x
Reference in New Issue
Block a user