Resolves: fdo#78477 ensure offset + sizeof(value) is in bounds

a) ptr is just added to offset, so move addition into 2nd arg

Change-Id: Ia3e8145c69324f19aeec8b0dd97284ec382d20d7
(cherry picked from commit 57ef375bed4480bbedc799aca274a6bd26745008)

b) sort in order of increasing offset

Change-Id: I0d2c880438f47f4527037d7ffaf77cf142d24751
(cherry picked from commit 95e92889d3fb0e8a85cefdeb07a02e57130a9799)

c) fdo#78477 ensure offset + sizeof(value) is in bounds

check that largest offset + value to read is inside available space

Change-Id: I4feac37bdfbae5061b3b75ddf44bb20fc5904656
(cherry picked from commit c888c211072f23cfb4cc488c641d8d822f930a33)
(cherry picked from commit 891e0f76350890a4dd4331820bde8c118ac06ab0)
Reviewed-on: https://gerrit.libreoffice.org/9641
Tested-by: Michael Stahl <mstahl@redhat.com>
Reviewed-by: Michael Stahl <mstahl@redhat.com>