summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2016-02-18 11:09:36 +0200
committerSebastian Dröge <sebastian@centricular.com>2016-02-18 11:09:36 +0200
commit5664fd7635679016714a40a521b1622fbc636418 (patch)
tree8ac7e14cd174183348f509d79d98350c7c32acf0 /gst
parent17d30e944be0425ebb4fb6046f82d1f61701fe8f (diff)
buffer: Protect against failing to map input memory when merging memories
https://bugzilla.gnome.org/show_bug.cgi?id=762239
Diffstat (limited to 'gst')
-rw-r--r--gst/gstbuffer.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gst/gstbuffer.c b/gst/gstbuffer.c
index db4a2379c..0ee8bf379 100644
--- a/gst/gstbuffer.c
+++ b/gst/gstbuffer.c
@@ -242,7 +242,14 @@ _get_merged_memory (GstBuffer * buffer, guint idx, guint length)
left = size;
for (i = idx; i < (idx + length) && left > 0; i++) {
- gst_memory_map (mem[i], &sinfo, GST_MAP_READ);
+ if (!gst_memory_map (mem[i], &sinfo, GST_MAP_READ)) {
+ GST_CAT_ERROR (GST_CAT_BUFFER,
+ "buffer %p, idx %u, length %u failed to map readable", buffer,
+ idx, length);
+ gst_memory_unmap (result, &dinfo);
+ gst_memory_unref (result);
+ return NULL;
+ }
tocopy = MIN (sinfo.size, left);
GST_CAT_DEBUG (GST_CAT_PERFORMANCE,
"memcpy %" G_GSIZE_FORMAT " bytes for merge %p from memory %p",