Commit 6fc06489 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '7b8c5b26'

* commit '7b8c5b26':
  vc1dec: prevent a crash due missing pred_flag parameter
  matroska: Fix use after free
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 8bfc8d88 7b8c5b26
...@@ -1149,8 +1149,12 @@ static av_always_inline void get_mvdata_interlaced(VC1Context *v, int *dmv_x, ...@@ -1149,8 +1149,12 @@ static av_always_inline void get_mvdata_interlaced(VC1Context *v, int *dmv_x,
*dmv_x = get_bits(gb, v->k_x); *dmv_x = get_bits(gb, v->k_x);
*dmv_y = get_bits(gb, v->k_y); *dmv_y = get_bits(gb, v->k_y);
if (v->numref) { if (v->numref) {
*pred_flag = *dmv_y & 1; if (pred_flag) {
*dmv_y = (*dmv_y + *pred_flag) >> 1; *pred_flag = *dmv_y & 1;
*dmv_y = (*dmv_y + *pred_flag) >> 1;
} else {
*dmv_y = (*dmv_y + (*dmv_y & 1)) >> 1;
}
} }
} }
else { else {
...@@ -1177,7 +1181,7 @@ static av_always_inline void get_mvdata_interlaced(VC1Context *v, int *dmv_x, ...@@ -1177,7 +1181,7 @@ static av_always_inline void get_mvdata_interlaced(VC1Context *v, int *dmv_x,
*dmv_y = (sign ^ ((val >> 1) + offs_tab[index1 >> v->numref])) - sign; *dmv_y = (sign ^ ((val >> 1) + offs_tab[index1 >> v->numref])) - sign;
} else } else
*dmv_y = 0; *dmv_y = 0;
if (v->numref) if (v->numref && pred_flag)
*pred_flag = index1 & 1; *pred_flag = index1 & 1;
} }
} }
......
...@@ -1881,6 +1881,7 @@ static int matroska_deliver_packet(MatroskaDemuxContext *matroska, ...@@ -1881,6 +1881,7 @@ static int matroska_deliver_packet(MatroskaDemuxContext *matroska,
*/ */
static void matroska_clear_queue(MatroskaDemuxContext *matroska) static void matroska_clear_queue(MatroskaDemuxContext *matroska)
{ {
matroska->prev_pkt = NULL;
if (matroska->packets) { if (matroska->packets) {
int n; int n;
for (n = 0; n < matroska->num_packets; n++) { for (n = 0; n < matroska->num_packets; n++) {
...@@ -2388,7 +2389,6 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index, ...@@ -2388,7 +2389,6 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
avio_seek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET); avio_seek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET);
matroska->current_id = 0; matroska->current_id = 0;
while ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) { while ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) {
matroska->prev_pkt = NULL;
matroska_clear_queue(matroska); matroska_clear_queue(matroska);
if (matroska_parse_cluster(matroska) < 0) if (matroska_parse_cluster(matroska) < 0)
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment