mirror of
https://github.com/brl/mutter.git
synced 2024-11-29 19:40:43 -05:00
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.
This commit is contained in:
parent
aafcee31b2
commit
525504f9bf
@ -458,11 +458,8 @@ cogl_buffer_set_data (CoglBuffer *buffer,
|
|||||||
const guint8 *data,
|
const guint8 *data,
|
||||||
gsize size)
|
gsize size)
|
||||||
{
|
{
|
||||||
if (!cogl_is_buffer (buffer))
|
g_return_val_if_fail (cogl_is_buffer (buffer), FALSE);
|
||||||
return FALSE;
|
g_return_val_if_fail ((offset + size) <= buffer->size, FALSE);
|
||||||
|
|
||||||
if (G_UNLIKELY((offset + size) > buffer->size))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return buffer->vtable.set_data (buffer, offset, data, size);
|
return buffer->vtable.set_data (buffer, offset, data, size);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user