STB Vorbis: prevent division by zero in decode_resign if ch == 0
In the call to decode_residue:
decode_residue(f, residue_buffers, ch, n2, r, do_not_decode);
The channel count is previously intialized as zero and incremented
based on a for-loop (f->channels) plus a conditional,
if (map->chan[j].mux == i). If this doesn't happen then 'ch'
remains zero.
Once inside decode_residue(..), the code has three branches based
on channel count: stereo (ch == 2), mono (ch == 1), and then the
exception if it's neither of those (simple 'else'). It's in here
where a zero-valued 'ch' can be used as the denominator in these
calculations:
int c_inter = z % ch
p_inter = z/ch;
Obviously this 'else' branch is meant for channel counts greater
than two an not for zero channels; so this change simply makes
that branch only valid if (ch > 2).
This commit is contained in:
parent
bedcc244d9
commit
a7a899fdb0
1 changed files with 1 additions and 1 deletions
|
|
@ -2253,7 +2253,7 @@ static void decode_residue(vorb *f, float *residue_buffers[], int ch, int n, int
|
|||
++class_set;
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
} else if (ch > 2) {
|
||||
while (pcount < part_read) {
|
||||
int z = r->begin + pcount*r->part_size;
|
||||
int c_inter = z % ch, p_inter = z/ch;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue