"In pixman_region32_init_rect: Invalid rectangle passed" when viewing a certain PDF
Submitted by Germán Poo-Caamaño
Assigned to poppler-bugs
Description
From Evince: https://bugzilla.gnome.org/show_bug.cgi?id=706567
A summary of the comments:
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 }}}
A PDF test case (8.8MB) is in http://media.zweitausendeins.de/download/?pdf/merkheft/271%2FMH271_interaktiv.pdf
The ouput of gdb shows a corrupted rectangle:
$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}
Finally Carlos said:
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.