mjpeg: Validate sampling factors
They must be non-zero. Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org
This commit is contained in:
parent
4b79668154
commit
8aa3500905
@ -265,6 +265,13 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
|||||||
s->quant_index[i] = get_bits(&s->gb, 8);
|
s->quant_index[i] = get_bits(&s->gb, 8);
|
||||||
if (s->quant_index[i] >= 4)
|
if (s->quant_index[i] >= 4)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
if (!s->h_count[i] || !s->v_count[i]) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR,
|
||||||
|
"Invalid sampling factor in component %d %d:%d\n",
|
||||||
|
i, s->h_count[i], s->v_count[i]);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
av_log(s->avctx, AV_LOG_DEBUG, "component %d %d:%d id: %d quant:%d\n",
|
av_log(s->avctx, AV_LOG_DEBUG, "component %d %d:%d id: %d quant:%d\n",
|
||||||
i, s->h_count[i], s->v_count[i],
|
i, s->h_count[i], s->v_count[i],
|
||||||
s->component_id[i], s->quant_index[i]);
|
s->component_id[i], s->quant_index[i]);
|
||||||
|
Loading…
Reference in New Issue
Block a user