openjpeg: guard against invalid memory access on crafted files

This commit is contained in:
Vincent Penquerc'h 2017-06-07 16:17:50 +01:00
parent e5a0c4a751
commit 903684aa78

View file

@ -1012,6 +1012,9 @@ gst_openjpeg_dec_handle_frame (GstVideoDecoder * decoder,
if (!gst_buffer_map (frame->input_buffer, &map, GST_MAP_READ))
goto map_read_error;
if (self->is_jp2c && map.size < 8)
goto open_error;
#ifdef HAVE_OPENJPEG_1
io = opj_cio_open ((opj_common_ptr) dec, map.data + (self->is_jp2c ? 8 : 0),
map.size - (self->is_jp2c ? 8 : 0));