diff options
author | Vincent Penquerc'h <vincent.penquerch@collabora.co.uk> | 2014-04-09 12:27:16 +0100 |
---|---|---|
committer | Edward Hervey <edward@collabora.com> | 2014-04-16 16:08:38 +0200 |
commit | 172c39812726c06b3a922a2a6c2fedc8f333a187 (patch) | |
tree | 3a952f5445b9a57f49d425812e1f38bbf2c6d8b5 /gst | |
parent | c45b44e30993807a7f9a94ad01f1c179c19510aa (diff) |
mxf: avoid dereferencing NULL mapping data pointer
Also unref buffers on error, as it seems to be done in one, but
not all, error paths.
The NULL pointer part is Coverity 206112
https://bugzilla.gnome.org/show_bug.cgi?id=727889
Diffstat (limited to 'gst')
-rw-r--r-- | gst/mxf/mxfup.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gst/mxf/mxfup.c b/gst/mxf/mxfup.c index b778bd94d..afb6d950f 100644 --- a/gst/mxf/mxfup.c +++ b/gst/mxf/mxfup.c @@ -139,10 +139,17 @@ mxf_up_handle_essence_element (const MXFUL * key, GstBuffer * buffer, if (key->u[12] != 0x15 || (key->u[14] != 0x01 && key->u[14] != 0x02 && key->u[14] != 0x03 && key->u[14] != 0x04)) { GST_ERROR ("Invalid uncompressed picture essence element"); + gst_buffer_unref (buffer); + return GST_FLOW_ERROR; + } + + if (!data) { + GST_ERROR ("Invalid mapping data"); + gst_buffer_unref (buffer); return GST_FLOW_ERROR; } - if (!data || (data->image_start_offset == 0 && data->image_end_offset == 0)) { + if (data->image_start_offset == 0 && data->image_end_offset == 0) { } else { if (data->image_start_offset + data->image_end_offset > gst_buffer_get_size (buffer)) { @@ -157,6 +164,7 @@ mxf_up_handle_essence_element (const MXFUL * key, GstBuffer * buffer, if (gst_buffer_get_size (buffer) != data->bpp * data->width * data->height) { GST_ERROR ("Invalid buffer size"); + gst_buffer_unref (buffer); return GST_FLOW_ERROR; } |