From 525504f9bf82eac89a0950c134544aa7ef034d64 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Mon, 18 Oct 2010 18:50:02 +0100 Subject: [PATCH] buffer: warn if (offset + size) > buffer->size previously we would silently bail out if the given offset + data size would overflow the buffer size. Now we use g_return_val_if_fail so we get a warning if we hit this case. --- cogl/cogl-buffer.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/cogl/cogl-buffer.c b/cogl/cogl-buffer.c index b1d724236..2c2baedf0 100644 --- a/cogl/cogl-buffer.c +++ b/cogl/cogl-buffer.c @@ -458,11 +458,8 @@ cogl_buffer_set_data (CoglBuffer *buffer, const guint8 *data, gsize size) { - if (!cogl_is_buffer (buffer)) - return FALSE; - - if (G_UNLIKELY((offset + size) > buffer->size)) - return FALSE; + g_return_val_if_fail (cogl_is_buffer (buffer), FALSE); + g_return_val_if_fail ((offset + size) <= buffer->size, FALSE); return buffer->vtable.set_data (buffer, offset, data, size); }