static struct pdf_object *pdf_get_object(struct pdf_doc *pdf, int index)
{
    return flexarray_get(&pdf->objects, index);
}

The product reads data past the end, or before the beginning, of the intended buffer.