I'm trying to understand if this is a bug (or if I simply misunderstood something because pdfium is very new to me). In our software we have a user that uploaded a pdf and I'm getting some strange results. I have created this small example to illustrate what I think is a bug:
Input is a FPDF_PAGE page with 116 annotations. If I run this code
FPDF_ANNOTATION annotation31 = FPDFPage_GetAnnot(page, 31);
FPDFAnnot_GetObject(annotation31, 2);
FPDF_ANNOTATION annotation48 = FPDFPage_GetAnnot(page, 48);
FPDF_PAGEOBJECT pageObject2 = FPDFAnnot_GetObject(annotation48, 2);
FPDF_PAGEOBJECT formObject2 = FPDFFormObj_GetObject(pageObject2, 2);
FS_MATRIX matrix = {};
FPDFPageObj_GetMatrix(formObject2, &matrix);
then I get a different matrix compared to if I simply remove
FPDF_ANNOTATION annotation31 = FPDFPage_GetAnnot(page, 31);
FPDFAnnot_GetObject(annotation31, 2);
from the above code. It seems to me that FPDFAnnot_GetObject(annotation31, 2) will change the output from FPDFPageObj_GetMatrix used for a completely different annotation.