Incorrect rendering triggered by cairo CAIRO_OPERATOR_SATURATE with subpixel positioning

Bug #1988796 reported by Benjamin Gilbert
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pixman (Ubuntu)
Fix Released
Undecided
Unassigned
Focal
Fix Released
Undecided
Athos Ribeiro

Bug Description

[ Impact ]

OpenSlide (libopenslide0 in Ubuntu) uses Cairo as its rendering backend, always with CAIRO_OPERATOR_SATURATE and sometimes with subpixel positioning (when reading certain file formats), and Cairo in turn invokes this code. As a result, some slides incorrectly render with large blank spaces and with some pixels rendered on top of other pixels. This effectively makes OpenSlide unusable for several of the file formats it supports. No workaround is believed possible within the OpenSlide codebase.

[ Test Plan ]

Compile and run the pixman.c test program uploaded to this bug. It should report "OK".

[ Where problems could occur ]

Problems would show up as incorrect pixel output from software that renders via Cairo or pixman.

[ Other Info ]

While I'm not a pixman expert, it appears that the change should only affect the broken code path, and it seems unlikely that anything else depends on the incorrect math fixed by this patch. This bug hasn't previously been reported in Ubuntu, which may imply that this code path is not exercised by other packages in the distro.

The affected source file has had no further commits upstream since this patch was applied in April 2019, and some basic commit grepping didn't turn up any followup fixes elsewhere in the tree.

[ Original message ]

pixman 0.38.4-0ubuntu1 in focal (and actually pixman 0.38.x generally) has a regression that causes incorrect rendering in some circumstances. This can be triggered by the use of cairo with CAIRO_OPERATOR_SATURATE and subpixel positioning, and causes OpenSlide <https://openslide.org/> to produce incorrect output.

The attached test program will print "Failed" if the bug exists, or "OK" if it doesn't.

This is fixed upstream in https://gitlab.freedesktop.org/pixman/pixman/-/commit/8256c235, which is in pixman 0.40.0.

See https://github.com/openslide/openslide/issues/278 for more context.

Revision history for this message
Benjamin Gilbert (bgilbert) wrote :
Revision history for this message
Benjamin Gilbert (bgilbert) wrote :

This is a debdiff for the focal version of pixman, 0.38.4-0ubuntu1. I've built and installed this and verified that the test case now reports "OK".

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "1-0.38.4-0ubuntu2.debdiff" seems to be a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. If the attachment isn't a patch, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are member of the ~ubuntu-sponsors, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issue please contact him.]

tags: added: patch
Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Hi Benjamin,

Thanks for taking the time to provide this fix!

Would you be willing to file the SRU template [1] for this bug so we can proceed here?

It would also be nice to add dep3 headers [2] to that patch.

[1] https://wiki.ubuntu.com/StableReleaseUpdates#SRU_Bug_Template
[2] https://dep-team.pages.debian.net/deps/dep3/

Revision history for this message
Benjamin Gilbert (bgilbert) wrote :

[ Impact ]

OpenSlide (libopenslide0 in Ubuntu) uses Cairo as its rendering backend, always with CAIRO_OPERATOR_SATURATE and sometimes with subpixel positioning (when reading certain file formats), and Cairo in turn invokes this code. As a result, some slides incorrectly render with large blank spaces and with some pixels rendered on top of other pixels. This effectively makes OpenSlide unusable for several of the file formats it supports. No workaround is believed possible within the OpenSlide codebase.

[ Test Plan ]

Compile and run the pixman.c test program uploaded to this bug. It should report "OK".

[ Where problems could occur ]

Problems would show up as incorrect pixel output from software that renders via Cairo or pixman.

[ Other Info ]

While I'm not a pixman expert, it appears that the change should only affect the broken code path, and it seems unlikely that anything else depends on the incorrect math fixed by this patch. This bug hasn't previously been reported in Ubuntu, which may imply that this code path is not exercised by other packages in the distro.

The affected source file has had no further commits upstream since this patch was applied in April 2019, and some basic commit grepping didn't turn up any followup fixes elsewhere in the tree.

Revision history for this message
Benjamin Gilbert (bgilbert) wrote :
description: updated
Changed in pixman (Ubuntu):
status: New → Fix Released
Changed in pixman (Ubuntu Focal):
status: New → Triaged
Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Thanks, Benjamin!

I uploaded a patched package to the following PPA: https://launchpad.net/~athos-ribeiro/+archive/ubuntu/lp1988796-pixman

Please, test it to ensure everything works as expected before we proceed with the SRU process here.

Revision history for this message
Benjamin Gilbert (bgilbert) wrote :

Yup, the test program fails without the packages from the PPA and succeeds once they're installed.

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Thanks. Uploaded!

Changed in pixman (Ubuntu Focal):
status: Triaged → In Progress
assignee: nobody → Athos Ribeiro (athos-ribeiro)
Revision history for this message
Benjamin Gilbert (bgilbert) wrote :

Thanks for the help!

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

The first upload was rejected due to some cruft in my upload. This is a 1.0 format source package and I was dealing with some issues when handling git (git ubuntu) being considered during the package build. Thanks for spotting that one, Timo :) I re-uploaded the package.

Revision history for this message
Timo Aaltonen (tjaalton) wrote : Please test proposed package

Hello Benjamin, or anyone else affected,

Accepted pixman into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/pixman/0.38.4-0ubuntu2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in pixman (Ubuntu Focal):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-focal
tags: added: verification-done-focal
removed: verification-needed-focal
Revision history for this message
Benjamin Gilbert (bgilbert) wrote :

Verified fixed with libpixman-1-0 0.38.4-0ubuntu2.

- The test program now reports "OK".
- I also installed the openslide-tools package and visually confirmed that "openslide-write-png CMU-1.mrxs 20000 100000 1 1000 1000 out.png" produces corrupt output with the original package and reasonable output with the fixed package. CMU-1.mrxs is available from https://openslide.cs.cmu.edu/download/openslide-testdata/Mirax/CMU-1.zip (538 MB).

tags: added: verification-done
removed: verification-needed
Changed in pixman (Ubuntu Focal):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.