dump display: fixed a crash

For opaque codecs (H.264), the allocated size was actually smaller than
(maximal) data len set. That is usually not an issue, but when
destroying, the invalid maximum is exported (because PUTF_DISCARD with
unmodified frame). Steps to reproduce:

    uv -t testcard:size=1280x128 -c libavcodec:codec=H.264 -d dump
This commit is contained in:
Martin Pulec
2022-04-28 10:43:20 +02:00
parent fad9d20ade
commit e9f8a95ea1

View File

@@ -173,10 +173,10 @@ static int display_dump_reconfigure(void *state, struct video_desc desc)
s->f->decoder_overrides_data_len = is_codec_opaque(desc.color_spec) != 0 ? TRUE : FALSE;
s->max_tile_data_len = MIN(8 * desc.width * desc.height, 1000000UL);
for (unsigned int i = 0; i < s->f->tile_count; ++i) {
s->f->tiles[i].data = (char *) malloc(s->f->tiles[i].data_len);
if (is_codec_opaque(desc.color_spec)) {
s->f->tiles[i].data_len = s->max_tile_data_len;
}
s->f->tiles[i].data = (char *) malloc(s->f->tiles[i].data_len);
}
s->f->callbacks.data_deleter = vf_data_deleter;