History

takdec: ensure chan2 is a valid channel index

If chan2 is not smaller than the number of channels, it can cause segmentation faults due to dereferencing a NULL pointer.

Andreas Cadhalpun committed 11 years ago

Commit a2d19221 parent 97655491 file · +6 −0Browse files

Unified · Split

libavcodec/takdec.c+6−0
@@ -806,6 +806,12 @@ static int tak_decode_frame(AVCodecContext *avctx, void *data, · 805 unmodified lines
806 if (s->mcdparams[i].present) {806 if (s->mcdparams[i].present) {
807 s->mcdparams[i].index = get_bits(gb, 2);807 s->mcdparams[i].index = get_bits(gb, 2);
808 s->mcdparams[i].chan2 = get_bits(gb, 4);808 s->mcdparams[i].chan2 = get_bits(gb, 4);
809 if (s->mcdparams[i].chan2 >= avctx->channels) {
810 av_log(avctx, AV_LOG_ERROR,
811 "invalid channel 2 (%d) for %d channel(s)\n",
812 s->mcdparams[i].chan2, avctx->channels);
813 return AVERROR_INVALIDDATA;
814 }
809 if (s->mcdparams[i].index == 1) {815 if (s->mcdparams[i].index == 1) {
810 if ((nbit == s->mcdparams[i].chan2) ||816 if ((nbit == s->mcdparams[i].chan2) ||
811 (ch_mask & 1 << s->mcdparams[i].chan2))817 (ch_mask & 1 << s->mcdparams[i].chan2))

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t