mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 08:00:53 +00:00
libsysprof-capture: check alignment in read length
We require aligned frames, so we might as well enforce it in the reader.
This commit is contained in:
@ -356,6 +356,9 @@ sysprof_capture_reader_ensure_space_for (SysprofCaptureReader *self,
|
|||||||
g_assert (self->pos <= self->len);
|
g_assert (self->pos <= self->len);
|
||||||
g_assert (len > 0);
|
g_assert (len > 0);
|
||||||
|
|
||||||
|
/* Ensure alignment of length to read */
|
||||||
|
len = (len + SYSPROF_CAPTURE_ALIGN - 1) & ~(SYSPROF_CAPTURE_ALIGN - 1);
|
||||||
|
|
||||||
if ((self->len - self->pos) < len)
|
if ((self->len - self->pos) < len)
|
||||||
{
|
{
|
||||||
gssize r;
|
gssize r;
|
||||||
|
|||||||
Reference in New Issue
Block a user