mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
jpegdec: Check return value of gst_buffer_map()
Without this check, the element will crash instead of returning an error.
This commit is contained in:
parent
eb0b676fae
commit
83e9d4f70d
1 changed files with 10 additions and 1 deletions
|
@ -1204,7 +1204,9 @@ gst_jpeg_dec_handle_frame (GstVideoDecoder * bdec, GstVideoCodecFrame * frame)
|
|||
guint8 *data;
|
||||
gsize nbytes;
|
||||
|
||||
gst_buffer_map (frame->input_buffer, &dec->current_frame_map, GST_MAP_READ);
|
||||
if (!gst_buffer_map (frame->input_buffer, &dec->current_frame_map,
|
||||
GST_MAP_READ))
|
||||
goto map_failed;
|
||||
|
||||
data = dec->current_frame_map.data;
|
||||
nbytes = dec->current_frame_map.size;
|
||||
|
@ -1393,6 +1395,13 @@ need_more_data:
|
|||
goto exit;
|
||||
}
|
||||
/* ERRORS */
|
||||
map_failed:
|
||||
{
|
||||
GST_ELEMENT_ERROR (dec, RESOURCE, READ, (_("Failed to read memory")),
|
||||
("gst_buffer_map() failed for READ access"));
|
||||
ret = GST_FLOW_ERROR;
|
||||
goto exit;
|
||||
}
|
||||
decode_error:
|
||||
{
|
||||
gchar err_msg[JMSG_LENGTH_MAX];
|
||||
|
|
Loading…
Reference in a new issue