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 683172 - Crash when doing a search in continuous dual page view and no page shown in the screen
Crash when doing a search in continuous dual page view and no page shown in t...
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: general
3.4.x
Other Linux
: Normal critical
: ---
Assigned To: Evince Maintainers
Evince Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-09-01 20:16 UTC by Benjamin Berg
Modified: 2013-06-14 16:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
libview: Don't update current_page to negative number (1.56 KB, patch)
2013-06-13 23:21 UTC, Germán Poo-Caamaño
committed Details | Review

Description Benjamin Berg 2012-09-01 20:16:25 UTC
I am able to reproduce this easily with a certain document in dual page layout.

Document: http://www.kvv.de/fileadmin/user_upload/kvv/dokumente/netz/liniennetz/2012/L0SCHI_SEP12_Internet.pdf

 1. Open the document. It should now be in dual page mode, scrolled to the top left corner so that nothing is visible
 2. Start searching. Ctrl+F
 3. Enter a search term, eg. "bann" it will crash.

Apparently page is -1, which means that the ev_view_find_get_n_results is passing an invalid pointer over to g_list_length.

Setting to minor, as it seems to only happen if you start searching right away, but not when scrolling around in the document first.

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff4550610 in g_list_length () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
(gdb) bt
  • #0 g_list_length
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #1 ev_view_find_get_n_results
    at /tmp/buildd/evince-3.4.0/./libview/ev-view.c line 5687
  • #2 jump_to_find_result
    at /tmp/buildd/evince-3.4.0/./libview/ev-view.c line 5702
  • #3 ev_view_find_changed
    at /tmp/buildd/evince-3.4.0/./libview/ev-view.c line 5760
  • #4 ev_window_find_job_updated_cb
    at /tmp/buildd/evince-3.4.0/./shell/ev-window.c line 5271
  • #5 g_cclosure_marshal_VOID(int0_t, void)
    from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
  • #6 ??
    from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
  • #7 g_signal_emit_valist
    from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
  • #8 g_signal_emit
    from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
  • #9 ev_job_find_run
    at /tmp/buildd/evince-3.4.0/./libview/ev-jobs.c line 1263
  • #10 g_main_context_dispatch
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #11 ??
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #12 g_main_loop_run
    from /lib/x86_64-linux-gnu/libglib-2.0.so.0
  • #13 gtk_main
    at /tmp/buildd/gtk+3.0-3.4.2/./gtk/gtkmain.c line 1161
  • #14 main
    at /tmp/buildd/evince-3.4.0/./shell/main.c line 329
  • #1 ev_view_find_get_n_results
    at /tmp/buildd/evince-3.4.0/./libview/ev-view.c line 5687
  • #2 jump_to_find_result
    at /tmp/buildd/evince-3.4.0/./libview/ev-view.c line 5702
$2 = -1
Comment 1 Benjamin Berg 2012-09-01 21:55:07 UTC
Hm, looks like the paste from gdb is not fully displayed above.

The "-1" is the current_page.

  • #2 jump_to_find_result
    at /tmp/buildd/evince-3.4.0/./libview/ev-view.c line 5702
$2 = -1
Comment 2 José Aliste 2013-02-09 11:43:08 UTC
Oh... indeed, the current_page is -1 in the case reported in Comment 0... At first sight I can't catch where it is being set to -1. 

@Benjamin. crashes  should be always marked as critical, even if they don't occur often.
Comment 3 Germán Poo-Caamaño 2013-06-09 01:51:24 UTC
Benjamin,

Can you reproduce the bug with newer evince?  I was able to reproduce it with 3.4.0 but not with 3.8.2.
Comment 4 Benjamin Berg 2013-06-09 09:16:12 UTC
I am still able to reproduce it (tried it with a different document).

The important part is, that directly after opening evince, you don't see any page on screen (because it is to the right). For that you need to enable dual page view, and scroll to the top left corner. Apparently it is also necessary to wait a bit so that the state is saved when evince closes.

After doing the above (dual page view + scrolling + waiting + closing) I can reproduce the issue with the document when starting evince again. This is version 3.8.2 (debian unstable/experimental).
Comment 5 Christian Persch 2013-06-09 21:47:51 UTC
Not reproducible here using evince, gtk+ git master and poppler 0.22 branch.
Comment 6 Germán Poo-Caamaño 2013-06-13 17:54:11 UTC
After installing gvfs in my jhbuild, I can reproduce it with master.

Program received signal SIGSEGV, Segmentation fault.
g_list_length (list=0x11) at glist.c:918
918	      list = list->next;

Thread 1 (Thread 0xb599aac0 (LWP 24142))

  • #0 g_list_length
    at glist.c line 918
  • #1 ev_view_find_get_n_results
    at ev-view.c line 6354
  • #2 jump_to_find_result
    at ev-view.c line 6369
  • #3 ev_view_find_changed
    at ev-view.c line 6451
  • #4 find_job_updated_cb
    at ev-view.c line 6423
  • #5 g_cclosure_marshal_VOID__INT
    at gmarshal.c line 372
  • #6 g_closure_invoke
    at gclosure.c line 777
  • #7 signal_emit_unlocked_R
    at gsignal.c line 3584
  • #8 g_signal_emit_valist
    at gsignal.c line 3328
  • #9 g_signal_emit
    at gsignal.c line 3384
  • #10 ev_job_find_run
    at ev-jobs.c line 1593
  • #11 ev_job_run
    at ev-jobs.c line 215
  • #12 ev_job_idle
    at ev-job-scheduler.c line 199
  • #13 g_idle_dispatch
    at gmain.c line 5205
  • #14 g_main_dispatch
    at gmain.c line 3054
  • #15 g_main_context_dispatch
    at gmain.c line 3630
  • #16 g_main_context_iterate
    at gmain.c line 3701
  • #17 g_main_context_iterate
    at gmain.c line 3638
  • #18 g_main_context_iteration
    at gmain.c line 3762
  • #19 g_application_run
    at gapplication.c line 1623
  • #20 main
    at main.c line 332

Comment 7 Germán Poo-Caamaño 2013-06-13 18:01:19 UTC
I forgot to mention:

These are the file attributes I have for the document:

  metadata::evince::continuous: 1
  metadata::evince::dual-page: 1
  metadata::evince::dual-page-odd-left: 0
  metadata::evince::fullscreen: 0
  metadata::evince::inverted-colors: 0
  metadata::evince::page: 0
  metadata::evince::show_toolbar: 1
  metadata::evince::sidebar_page: thumbnails
  metadata::evince::sidebar_size: 255
  metadata::evince::sidebar_visibility: 0
  metadata::evince::sizing_mode: free
  metadata::evince::window_height: 774
  metadata::evince::window_maximized: 0
  metadata::evince::window_width: 1018
  metadata::evince::zoom: 0.70710676908493042
  metadata::evince::window_x: 124
  metadata::evince::window_y: 156

To reproduce the bug:

1. I open the document, which already has the attributes described above.
2. Ctrl-F
3. Try to type 'bann'
4. Segfault after entering 'b'
Comment 8 Germán Poo-Caamaño 2013-06-13 21:00:08 UTC
I think I know where the problem is, but not how to solve it.

  • #10 ev_job_find_run
    at ev-jobs.c line 1593
  • #4 find_job_updated_cb
    at ev-view.c line 6423
  • #3 ev_view_find_changed
    at ev-view.c line 6451
jump_to_find_result (view);

There is nothing to do here, view->current_page = -1
Comment 9 Germán Poo-Caamaño 2013-06-13 21:01:47 UTC
Damn bugzilla.  Rewriting my comment:

10 ... in ev_job_find_run (job=0x8488170) at ev-jobs.c:1593

g_signal_emit (job_find, job_find_signals[FIND_UPDATED], 0, job_find->current_page);

job_find->current_page is 0.

[signal emitted]

4  ... in find_job_updated_cb (job=0x8488170, page=0, view=0x837a028)
    at ev-view.c:6423

ev_view_find_changed (view, ev_job_find_get_results (job), page);

page = 0.  But, from now on evince relies on view, whose current_page = -1.  I think it is -1 because there is no page visible (it is outside of the view area because of the zoom), in spite the document only has 1 page.


3  ... in ev_view_find_changed (view=0x837a028, results=0x85547c0, 
    page=0) at ev-view.c:6451
Comment 10 Germán Poo-Caamaño 2013-06-13 21:15:57 UTC
FWIW, I can reproduce the bug with any document.  The document has to be opened twice.

1. Open a document
2. Set to Dual Page
3. Set the zoom to high percentage.
   The purpose is to make the drawing area grey, that is, no page shown.
4. Close the document.

5. Re-open the document.  If it stores the metadata, then, there is no 
   "current_page" because a grey background is shown.
6. Ctrl-F
7. Enter any character.
8. Segfault.
Comment 11 Germán Poo-Caamaño 2013-06-13 23:17:17 UTC
Updated the summary.  The issue only happens in continuous mode with dual page.
Comment 12 Germán Poo-Caamaño 2013-06-13 23:21:31 UTC
Created attachment 246773 [details] [review]
libview: Don't update current_page to negative number

In continuous mode with dual page view, there is a chance
that the pages were outside of the scroll view.  When
opening a document in such circumstances, the current
page should not be updated to a negative number when
already has the first page as default.

This fixes a crash when searching with a negative
current page.
Comment 13 Carlos Garcia Campos 2013-06-14 15:42:18 UTC
Review of attachment 246773 [details] [review]:

Good catch!

::: libview/ev-view.c
@@ +740,3 @@
 			best_current_page = MAX (best_current_page, view->start_page);
 
+			if (best_current_page >=0 && view->current_page != best_current_page) {

leave a space after >=
Comment 14 Germán Poo-Caamaño 2013-06-14 16:39:06 UTC
Review of attachment 246773 [details] [review]:

Committed in both master and gnome-3-8.