You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Layout: a zero image dimension emits a non-invertible transformation matrix #478
A LayoutImage with Width or Height set to zero emits a transformation matrix that cannot be
inverted, which ISO 32000-1 leaves undefined for a painted XObject.
LayoutImageRenderer.Layout computes _w = _img.Width ?? area.Width and then _h = _img.Height ?? (_w / imgW * imgH), so a zero width propagates through the aspect-ratio
division and collapses the height too. Nothing rejects either value, and the height check _h > area.Height passes trivially at zero.
Measured on 4788c4b, a 200x200pt page at 10pt margins with a 2x2 PNG:
Setting
Emitted matrix
Neither set
180 0 0 180 10 10 cm
Width = 0
0 0 0 0 10 190 cm
Height = 0
180 0 0 0 10 190 cm
Two things to note beyond the singular matrix. Both zero cases also move the y origin from 10 to
190, because a zero-height element reserves nothing and the cursor stays at the top of the content
box. And Width = 0 collapses both scales, because the aspect ratio is preserved through the
zero.
There is a test named for this: HardeningTests.LayoutImage_zeroDimensions_throwsArgumentException.
It does not test it. Its own comment says so, and what it actually asserts is that a valid 2x2
image saves without throwing. The name should be corrected along with the behaviour.
This belongs to the validation theme already scoped for 2.3.2, alongside the non-finite guards: a
zero or negative dimension emits an invalid or undefined construct today, so naming the value
changes no working document.
Reported by VellumPdfShowcase against 2.3.1; the matrices above are my own reproduction against
main and match theirs verbatim.
Activity
fix(layout): close the review round on the refusal messages
fix(layout): name the input a renderer refuses, instead of the page size
fix(layout): close the review round on the refusal messages