After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 706567 - "In pixman_region32_init_rect: Invalid rectangle passed" when viewing a certain PDF
"In pixman_region32_init_rect: Invalid rectangle passed" when viewing a certa...
Status: RESOLVED NOTGNOME
Product: evince
Classification: Core
Component: PDF
3.8.x
Other Linux
: Normal normal
: ---
Assigned To: Evince Maintainers
Evince Maintainers
: 722536 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-08-22 10:02 UTC by jaseg
Modified: 2014-01-20 12:43 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description jaseg 2013-08-22 10:02:41 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.
Comment 1 jaseg 2013-08-22 10:03:27 UTC
I forgot, my evince version is 3.8.3.
Comment 2 Christian Persch 2013-09-17 19:38:15 UTC
Confirming.

  • #0 _pixman_log_error
    at pixman-utils.c line 297
  • #1 pixman_region32_init_rect
    at pixman-region.c line 389
  • #2 INT_cairo_region_union_rectangle
    at cairo-region.c line 709
  • #3 create_region_from_poppler_region
    at ev-poppler.cc line 2089
  • #4 pdf_document_text_get_text_mapping
    at ev-poppler.cc line 2148
  • #5 ev_document_text_get_text_mapping
    at ev-document-text.c line 69
  • #6 ev_job_page_data_run
    at ev-jobs.c line 743
  • #7 ev_job_run
    at ev-jobs.c line 215
  • #8 ev_job_thread
    at ev-job-scheduler.c line 184
  • #9 ev_job_thread_proxy
    at ev-job-scheduler.c line 217
  • #10 g_thread_proxy
    at /home/chpe/devel/checkout/glib/glib/gthread.c line 798
  • #11 start_thread
    at pthread_create.c line 308
  • #12 clone
    at ../sysdeps/unix/sysv/linux/i386/clone.S line 131

Looks like a poppler bug ?
Comment 3 Germán Poo-Caamaño 2013-09-17 21:40:11 UTC
Can anybody attach a PDF test case?

I tried with a couple and I've been unable to reproduce it.
Comment 4 Christian Persch 2013-09-17 21:57:27 UTC
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.
Comment 5 Germán Poo-Caamaño 2013-09-17 22:17:28 UTC
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.
Comment 6 Germán Poo-Caamaño 2013-09-17 22:20:43 UTC
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.
Comment 7 Christian Persch 2013-09-17 23:42:06 UTC
I see this with poppler 0.24.1 (self-built), system cairo-1.12.14-2.fc19.i686 .
Comment 8 Germán Poo-Caamaño 2013-09-18 01:29:54 UTC
(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.
Comment 9 Germán Poo-Caamaño 2013-09-18 01:44:08 UTC
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)
Comment 10 José Aliste 2013-09-18 02:03:08 UTC
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
  • #1 pixman_region32_init_rect
    at pixman-region.c line 389
$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...
Comment 11 Germán Poo-Caamaño 2013-09-18 03:34:00 UTC
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.
Comment 12 Germán Poo-Caamaño 2013-09-18 03:56:40 UTC
(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()
Comment 13 Carlos Garcia Campos 2013-09-28 08:27:21 UTC
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.
Comment 14 Christian Persch 2013-09-28 09:17:50 UTC
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.
Comment 15 Germán Poo-Caamaño 2013-11-03 02:39:47 UTC
Forwarded to https://bugs.freedesktop.org/show_bug.cgi?id=71177
Comment 16 Christian Persch 2014-01-20 12:43:05 UTC
*** Bug 722536 has been marked as a duplicate of this bug. ***