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:
Christian Hergert
2020-02-23 14:27:57 -08:00
parent fd215a39a3
commit 988ad116a4

View File

@ -356,6 +356,9 @@ sysprof_capture_reader_ensure_space_for (SysprofCaptureReader *self,
g_assert (self->pos <= self->len);
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)
{
gssize r;