Page 1 of 1

[upd][segfault] djvu -> *

Posted: 2011-05-23T10:38:39-07:00
by Tanger
Hello.
I use ImageMagick 6.6.8-5 (Gentoo)
When I tried to convert from djvu to png, I got a segmentation fault.

# convert book1.djvu 1.%d.png

My USE flags are "media-gfx/imagemagick png jpeg tiff djvu fontconfig truetype autotrace gs jbig jpeg2k lqr raw svg wmf xml"

I tried to change USE flags to djvu and png only, but got the same result.

Code: Select all

$ strace convert book1.djvu 1.%d.png 2> /tmp/convert_log 2>&1 | tail -n 40


futex(0x87ed31c, FUTEX_WAKE_PRIVATE, 1) = 0
read(3, "", 65536)                      = 0
gettimeofday({1306172115, 685360}, NULL) = 0
clock_gettime(CLOCK_REALTIME, {1306172115, 685387370}) = 0
futex(0x87ed31c, FUTEX_WAKE_PRIVATE, 1) = 0
gettimeofday({1306172115, 685434}, NULL) = 0
clock_gettime(CLOCK_REALTIME, {1306172115, 685456584}) = 0
futex(0x87ed31c, FUTEX_WAKE_PRIVATE, 1) = 0
read(3, "", 65536)                      = 0
gettimeofday({1306172115, 685528}, NULL) = 0
clock_gettime(CLOCK_REALTIME, {1306172115, 685553682}) = 0
futex(0x87ed31c, FUTEX_WAKE_PRIVATE, 1) = 0
gettimeofday({1306172115, 685601}, NULL) = 0
futex(0x87ed31c, FUTEX_WAKE_PRIVATE, 1) = 1
clock_gettime(CLOCK_REALTIME, {1306172115, 685642738}) = 0
futex(0x87ed334, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x87ed31c, FUTEX_WAKE_PRIVATE, 1) = 0
gettimeofday({1306172115, 691702}, NULL) = 0
clock_gettime(CLOCK_REALTIME, {1306172115, 691724437}) = 0
futex(0x87ed31c, FUTEX_WAKE_PRIVATE, 1) = 0
brk(0x8dfe000)                          = 0x8dfe000
mmap2(NULL, 39505920, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb2c38000
mmap2(NULL, 4395008, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb2807000
mmap2(NULL, 2998272, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb252b000
munmap(0xb252b000, 2998272)             = 0
mmap2(NULL, 2998272, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb252b000
munmap(0xb252b000, 2998272)             = 0
mmap2(NULL, 2998272, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb252b000
munmap(0xb252b000, 2998272)             = 0
mmap2(NULL, 39505920, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb025a000
munmap(0xb2807000, 4395008)             = 0
mmap2(NULL, 13168640, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xaf5cb000
munmap(0xaf5cb000, 13168640)            = 0
mmap2(NULL, 421888, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb01f3000
munmap(0xb01f3000, 421888)              = 0
brk(0x8e22000)                          = 0x8e22000
munmap(0xb025a000, 39505920)            = 0
mmap2(NULL, 105349120, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xac7c0000
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++

Code: Select all

$ gdb --args convert /var/ftp/stuff/book1.djvu 1.%d.png


GNU gdb (Gentoo 7.2 p1) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /usr/bin/convert...done.
(gdb) run
Starting program: /usr/bin/convert /var/ftp/stuff/book1.djvu 1.%d.png
[Thread debugging using libthread_db enabled]
[New Thread 0xb7746b70 (LWP 26539)]
[Thread 0xb7746b70 (LWP 26539) exited]
[New Thread 0xb7746b70 (LWP 26540)]
[Thread 0xb7746b70 (LWP 26540) exited]
[New Thread 0xb7746b70 (LWP 26554)]
[New Thread 0xb66e4b70 (LWP 26555)]
[Thread 0xb66e4b70 (LWP 26555) exited]
[Thread 0xb7746b70 (LWP 26554) exited]

Program received signal SIGSEGV, Segmentation fault.
0xb7ec8601 in ImportQuantumPixels (image=0x8064e78, image_view=0x0, quantum_info=0xb6e80568, quantum_type=RGBQuantum, pixels=<value optimized out>, 
    exception=0x8068040) at magick/quantum-import.c:2312
2312   magick/quantum-import.c: Нет такого файла или каталога.
   in magick/quantum-import.c
(gdb) thread apply all bt

Thread 1 (Thread 0xb7c51780 (LWP 26536)):
#0  0xb7ec8601 in ImportQuantumPixels (image=0x8064e78, image_view=0x0, quantum_info=0xb6e80568, quantum_type=RGBQuantum, pixels=<value optimized out>, 
    exception=0x8068040) at magick/quantum-import.c:2312
#1  0xb7ff3c95 in get_page_image (image_info=0x8054278, exception=0x804b560) at coders/djvu.c:443
#2  ReadOneDJVUImage (image_info=0x8054278, exception=0x804b560) at coders/djvu.c:678
#3  ReadDJVUImage (image_info=0x8054278, exception=0x804b560) at coders/djvu.c:872
#4  0xb7de1137 in ReadImage (image_info=0x8050120, exception=0x804b560) at magick/constitute.c:578
#5  0xb7de2577 in ReadImages (image_info=0x8050120, exception=0x804b560) at magick/constitute.c:884
#6  0xb7c9658a in ConvertImageCommand (image_info=0x8050120, argc=3, argv=0x8054228, metadata=0x0, exception=0x804b560) at wand/convert.c:586
#7  0xb7d3eb62 in MagickCommandGenesis (image_info=0x804b600, command=0x804865c <ConvertImageCommand@plt>, argc=3, argv=0xbfffedb4, metadata=0x0, 
    exception=0x804b560) at wand/mogrify.c:169
#8  0x080487cf in main (argc=3, argv=0xbfffedb4) at utilities/convert.c:80
(gdb) c
Continuing.

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
(gdb) Quit
Sorry for my language.

Artem Mikheev.

Re: [segfault] djvu -> *

Posted: 2011-05-23T12:08:47-07:00
by magick
Post a URL to your image. We need to reproduce the problem to ensure our patch fixes the problem. Thanks.

Re: [segfault] djvu -> *

Posted: 2011-05-23T12:22:11-07:00
by Tanger
Sorry. I forgot to do it. http://tmp.mikhe.ru/book1.djvu (4,4Mb)

Re: [segfault] djvu -> *

Posted: 2011-05-23T14:30:36-07:00
by magick
We have a patch for the problem you reported in ImageMagick 6.7.0 Beta available by sometime tomorrow. Thanks.

Re: [segfault] djvu -> *

Posted: 2011-05-23T14:49:13-07:00
by Tanger
I did not expect that it will be so quickly!
Thanks!

Re: [segfault] djvu -> *

Posted: 2011-05-24T03:03:17-07:00
by Tanger
It's happend again.
GDB: http://pastebin.com/jRVhHySk

Re: [upd][segfault] djvu -> *

Posted: 2011-05-24T05:35:07-07:00
by magick
We're using ImageMagick 6.7.0 with this command:
  • convert -limit area 0 book1.djvu book-%02d.png
and it runs without complaint. There is a possibility that memory is getting corrupted by the DJVU delegate library.

Re: [upd][segfault] djvu -> *

Posted: 2011-05-24T09:52:00-07:00
by Tanger
segfault.

Code: Select all

[Thread 0xb6928b70 (LWP 18658) exited]
[Thread 0xb5fffb70 (LWP 18657) exited]
[New Thread 0xb5fffb70 (LWP 18660)]
[New Thread 0xb6928b70 (LWP 18661)]
[Thread 0xb6928b70 (LWP 18661) exited]
[Thread 0xb5fffb70 (LWP 18660) exited]
terminate called after throwing an instance of 'GException'

Program received signal SIGABRT, Aborted.
0xb78e3330 in raise () from /lib/libc.so.6
(gdb)
Segfalt occurs when there are no free space in /tmp. I have 7 GB free space available in /tmp.

Re: [upd][segfault] djvu -> *

Posted: 2011-05-24T10:01:59-07:00
by magick
Easy fix. See http://www.imagemagick.org/Usage/files/#massive and look for MAGICK_TMPDIR.

Re: [upd][segfault] djvu -> *

Posted: 2011-05-24T10:48:14-07:00
by Tanger
O_o
Yes it's works, but... 13Gb!!
Why it so large?? I can't understand it!
I'm shocked!
Viewer does not need so many temporary files!