mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
wmalossless: error out if a subframe is not used by any channel.
Prevents infinite loop because min_channel_len never increments. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org
This commit is contained in:
parent
75d7975268
commit
3c9267673e
@ -330,21 +330,28 @@ static int decode_tilehdr(WmallDecodeCtx *s)
|
|||||||
|
|
||||||
/* loop until the frame data is split between the subframes */
|
/* loop until the frame data is split between the subframes */
|
||||||
do {
|
do {
|
||||||
int subframe_len;
|
int subframe_len, in_use = 0;
|
||||||
|
|
||||||
/* check which channels contain the subframe */
|
/* check which channels contain the subframe */
|
||||||
for (c = 0; c < s->num_channels; c++) {
|
for (c = 0; c < s->num_channels; c++) {
|
||||||
if (num_samples[c] == min_channel_len) {
|
if (num_samples[c] == min_channel_len) {
|
||||||
if (fixed_channel_layout || channels_for_cur_subframe == 1 ||
|
if (fixed_channel_layout || channels_for_cur_subframe == 1 ||
|
||||||
(min_channel_len == s->samples_per_frame - s->min_samples_per_subframe)) {
|
(min_channel_len == s->samples_per_frame - s->min_samples_per_subframe)) {
|
||||||
contains_subframe[c] = 1;
|
contains_subframe[c] = in_use = 1;
|
||||||
} else {
|
} else {
|
||||||
contains_subframe[c] = get_bits1(&s->gb);
|
if (get_bits1(&s->gb))
|
||||||
|
contains_subframe[c] = in_use = 1;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
contains_subframe[c] = 0;
|
contains_subframe[c] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!in_use) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR,
|
||||||
|
"Found empty subframe\n");
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
/* get subframe length, subframe_len == 0 is not allowed */
|
/* get subframe length, subframe_len == 0 is not allowed */
|
||||||
if ((subframe_len = decode_subframe_length(s, min_channel_len)) <= 0)
|
if ((subframe_len = decode_subframe_length(s, min_channel_len)) <= 0)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
Loading…
Reference in New Issue
Block a user