GNOME Bugzilla – Bug 706567
"In pixman_region32_init_rect: Invalid rectangle passed" when viewing a certain PDF
Last modified: 2014-01-20 12:43:05 UTC
When viewing the attached PDF and scrolling to the end, evince shows the following warnings on the console (but continues to function properly without apparent rendering issues): {{{ *** BUG *** In pixman_region32_init_rect: Invalid rectangle passed Set a breakpoint on '_pixman_log_error' to debug *** BUG *** In pixman_region32_init_rect: Invalid rectangle passed Set a breakpoint on '_pixman_log_error' to debug }}} The PDF in question is a scientific article downloaded through an university account. It is probably watermarked.
I forgot, my evince version is 3.8.3.
Confirming.
+ Trace 232495
Looks like a poppler bug ?
Can anybody attach a PDF test case? I tried with a couple and I've been unable to reproduce it.
I reproduced with this one: http://media.zweitausendeins.de/download/?pdf/merkheft/271%2FMH271_interaktiv.pdf Just opening the pdf on the first page was enough to trigger the error.
Thanks Christian. However, I can't reproduce it in my machine. I tried with evince/poppler: 3.4.0/0.18.4, 3.8.2/0.20.0 and 3.9.90/0.24.1 Cairo: 1.10.2 for the first 2, and cairo 1.12.16 for the 3.9.90. FWIW, I use 32bits if that makes any difference.
Christian, can you still reproduce it with master? Anyway, as you said, likely the a problem in poppler, cairo or pixman. Just reproducing it with poppler-glib-demo should be enough to move the bug to bugs.freedesktop.org.
I see this with poppler 0.24.1 (self-built), system cairo-1.12.14-2.fc19.i686 .
(In reply to comment #7) > I see this with poppler 0.24.1 (self-built), system cairo-1.12.14-2.fc19.i686 . I checked and Fedora ships libpixman 0.30. I have 0.24 in my machine. I built pixman from git (0.31.1) and cairo 0.12.14 from tarball, and I can reproduce the issue with Evince, but not with poppler-glib-demo. I wonder what Evince makes different than poppler-glib-demo.
It does not seem to be a bug in poppler. In the backtrace there is not call to poppler. If there is a bug, I suspect it can be in libpixman. FWIW, the issue is reproducible also with cairo master (besides libpixman master)
it is not clear whether it is a bug on pixman. It seems the poppler region is invalid. I get the same trace: (gdb) up
+ Trace 232496
$2 = {extents = {x1 = 501, y1 = 479, x2 = 483, y2 = 504}, data = 0x7bae00} (gdb) print *region->data $3 = {size = 8105376, numRects = 8106176} (gdb) print region->data $4 = (pixman_region32_data_t *) 0x7bae00 (gdb) print *(region->data) $5 = {size = 8105376, numRects = 8106176} so it does look like something being corrupted here...
It seems the bug has existed for a while, but now we notice it because of http://cgit.freedesktop.org/pixman/commit/?id=4dced81 -------------------------------------- Turn on error logging at all times While releasing 0.29.2 the distcheck run produced a number of error messages that had to be fixed in 349015e1fc5d912ba4253133b90e751d0b. These were not caught before so nobody had actually run pixman with debugging turned on. It's not the first time this has happened, see 5b0563f39eb29e4ae431717696174da5 for example. So this patch makes the return_if_fail() macros use unlikely() around the expressions and then turns on error logging at all times. The performance hit should negligible since we were already evaluating the expressions. The place where DEBUG actually does cause a performance hit is in the region selfcheck code, and that will still only be enabled in development snapshots. -------------------------------------- I cherry-picked that commit and http://cgit.freedesktop.org/pixman/commit/?id=f4c9492 on an older pixman (<0.29.2) and with cairo 0.12.16 and I get the same output. My speculation would be: either we are hitting a bug in pixmap or cairo or we are sending an invalid rectangle that passes unchecked. It is unnoticed because at some point we sent a valid one.
(In reply to comment #10) > it is not clear whether it is a bug on pixman. It seems the poppler region is > invalid. I get the same trace: > [...] > so it does look like something being corrupted here... Søren made a similar comment: <ssp> gpoo: If you look at the rectangle passed to pixman: <ssp> $2 = {extents = {x1 = 501, y1 = 479, x2 = 483, y2 = 504}, data = 0x7bae00} <ssp> (gdb) print *region->data <ssp> It has x2 < x1 which makes it invalid. That's why you get the debug spew <ssp> So it's not a bug in pixman, pixman is just detecting it similar to g_return_if_fail()
It's a poppler bug actually that is giving us incorrect rectangles as selection region. That document is a challenge for poppler, it contains vertical text and even inclined text. Poppler doesn't support it, it assumes that all characters in a line are at the same yMin - yMax range. So, there are several approaches to solve/workaround the issue. We can check rectangles are valid in evince and ignore the invalid ones, maybe showing a warning, but I think it would be better to do it in poppler, either poppler glib or directly in TextOutputDev.
Can someone please forward this to poppler bz then? I don't think we should check that rectangles are valid in evince; it's poppler's API that should return valid data.
Forwarded to https://bugs.freedesktop.org/show_bug.cgi?id=71177
*** Bug 722536 has been marked as a duplicate of this bug. ***