[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gstreamer-cvs
Subject:    [0.10] gst-plugins-bad: shm: Make sure to not allocate blocks larger than the shared mem area
From:       tester () kemper ! freedesktop ! org (Olivier CrĂȘte)
Date:       2013-02-28 18:20:32
Message-ID: 20130228182032.449F076027 () kemper ! freedesktop ! org
[Download RAW message or body]

Module: gst-plugins-bad
Branch: 0.10
Commit: 2070077413c833dc2f24c03543b1a37b98f0d6e6
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=2070077413c833dc2f24c03543b1a37b98f0d6e6


Author: Olivier CrĂȘte <olivier.crete@collabora.com>
Date:   Wed Feb 27 20:57:56 2013 -0500

shm: Make sure to not allocate blocks larger than the shared mem area

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=681359

---

 sys/shm/shmalloc.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/sys/shm/shmalloc.c b/sys/shm/shmalloc.c
index 67bae73..62c2bc7 100644
--- a/sys/shm/shmalloc.c
+++ b/sys/shm/shmalloc.c
@@ -102,13 +102,11 @@ shm_alloc_space_alloc_block (ShmAllocSpace * self, unsigned \
long size)  prev_item = item;
   }
 
-  /* Did not find space before an existing block */
-  if (self->blocks && !item) {
-    /* Return NULL if there is no big enough space, otherwise, there is space
-     * at the end */
-    if (self->size - prev_end_offset < size)
-      return NULL;
-  }
+  /* Return NULL if there is no big enough space, otherwise, there is space
+   * at the end */
+  assert (prev_end_offset <= self->size);
+  if (!item && self->size - prev_end_offset < size)
+    return NULL;
 
   block = spalloc_new (ShmAllocBlock);
   memset (block, 0, sizeof (ShmAllocBlock));



_______________________________________________
gstreamer-commits mailing list
gstreamer-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/gstreamer-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic