Bug 648885

Summary: [Contrib] fbi/exiftran crashes while rotating JPEG image
Product: [openSUSE] openSUSE 11.3 Reporter: Axel Schwank <axel>
Component: OtherAssignee: Petr Uzel <puzel>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P3 - Medium CC: andreas, cwh, meissner, pgajdos, puzel
Version: Final   
Target Milestone: ---   
Hardware: x86-64   
OS: openSUSE 11.3   
Whiteboard: contrib fbi
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Axel Schwank 2010-10-24 20:24:02 UTC
User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.1.14) Gecko/20101013 SUSE/2.0.9-2.1 SeaMonkey/2.0.9

I tried to roate a JEPG image with
exiftran -9 -i -p image.jpeg
which causes a segmentation fault.

Reproducible: Always

Steps to Reproduce:
1. Try to rotate an image with exiftran -9 -i -p file.jepg
I think any JPEG image would do, if not, I can provide a sample image which caused the crash.
Actual Results:  
Segmantation fault. For analysis I compiled exiftran from source, which yields the same result as using the installed version.
Some GDB output:

Core was generated by `/home/schwank/Dokumente/Ablage/Pakete/fbida-2.07/exiftran -9 -i -p IMGA0003.jpeg'.
Program terminated with signal 11, Segmentation fault.
#0  0x0000000000405ba4 in transpose_critical_parameters (dstinfo=0x7fffdb834a00) at jpeg/transupp.c:656
656         itemp = compptr->h_samp_factor;
(gdb) p compptr
$1 = (jpeg_component_info *) 0x300000008
(gdb) p compptr->h_samp_factor
Cannot access memory at address 0x300000010
(gdb) p *compptr
Cannot access memory at address 0x300000008
(gdb) p dstinfo->comp_info
$2 = (jpeg_component_info *) 0x300000008
(gdb) bt
#0  0x0000000000405ba4 in transpose_critical_parameters (dstinfo=0x7fffdb834a00) at jpeg/transupp.c:656
#1  0x0000000000405f13 in jtransform_adjust_parameters (srcinfo=0x7fffdb834770, dstinfo=0x7fffdb834a00, src_coef_arrays=0x61da08, info=0x7fffdb834700)
    at jpeg/transupp.c:785
#2  0x000000000040397f in do_transform (src=0x7fffdb834770, dst=0x7fffdb834a00, transform=JXFORM_ROT_90, comment=0x0, thumbnail=0x0, tsize=0, flags=1)
    at jpegtools.c:442
#3  0x000000000040341e in do_thumbnail (ed=0x617720, transform=JXFORM_ROT_90) at jpegtools.c:297
#4  0x000000000040367e in do_exif (src=0x7fffdb835370, transform=0x7fffdb834e5c, thumbnail=0x0, tsize=0, flags=547) at jpegtools.c:362
#5  0x00000000004038c0 in do_transform (src=0x7fffdb835370, dst=0x7fffdb835120, transform=JXFORM_ROT_90, comment=0x0, thumbnail=0x0, tsize=0, flags=547)
    at jpegtools.c:423
#6  0x0000000000403b1a in jpeg_transform_fp (in=0x60d010, out=0x60d270, transform=JXFORM_ROT_90, comment=0x0, thumbnail=0x0, tsize=0, flags=547)
    at jpegtools.c:491
#7  0x0000000000403f85 in jpeg_transform_inplace (file=0x7fffdb836284 "IMGA0003.jpeg", transform=JXFORM_ROT_90, comment=0x0, thumbnail=0x0, tsize=0, 
    flags=547) at jpegtools.c:588
#8  0x0000000000402640 in main (argc=5, argv=0x7fffdb8358a8) at exiftran.c:263


Expected Results:  
The image sould have been rotated.

It could be a compatibility issue of libjpeg.
openSuSE 11.3 only comes with libjpeg-devel from libjpeg8, so exiftran is probably built with that version.
But fbida has an own copy of jpeglib.h from version 6.2 which might cause trouble.
Just a guess.
Comment 1 Marcus Meissner 2010-10-26 07:27:18 UTC
where did you get "exiftran" from, it is not in the distribution.

(jpegtran is, but you probably dont mean it)
Comment 2 Axel Schwank 2010-10-26 20:01:52 UTC
Oh yes, shame on me.
It is not part of the distribution, but installed from the "Main Reposiory (Contrib)" of OBS. Should the problem better be reported to the author of exiftran?
Comment 3 Marcus Meissner 2010-10-27 07:49:18 UTC
you can report upstream, I will also assign this bug to the COntrib bugowners.


from source package "fbi"


(there is no direct maintainer of the "fbi" package assigned?!?)
Comment 4 Petr Uzel 2010-10-27 08:34:34 UTC
(In reply to comment #3)
> you can report upstream, I will also assign this bug to the COntrib bugowners.
> 
> from source package "fbi"
> 
> (there is no direct maintainer of the "fbi" package assigned?!?)

There is:

$ osc maintainer openSUSE:Factory:Contrib fbi
bugowner of openSUSE:Factory:Contrib/fbi : 
puzel

maintainer of openSUSE:Factory:Contrib/fbi : 
puzel


So I will take it. But still, please report it upstream, Alex. Thank you.
Comment 5 Petr Uzel 2010-11-11 10:28:27 UTC
*** Bug 648887 has been marked as a duplicate of this bug. ***
Comment 6 Petr Gajdos 2010-11-23 14:04:08 UTC
(In reply to comment #0)
> I tried to roate a JEPG image with
> exiftran -9 -i -p image.jpeg
> which causes a segmentation fault.

New package is in openSUSE:Factory:Contrib, please test.

> Just a guess.

Good guess. I have used needed *.h and transupp.c from current jpeg.

Question is, if it is really to be upstreamable. And we will probably change to libjpeg-turbo, which can introduce similar problem in the near future.

I suggest close this bug as soon as you confirm, that package works for you.
Comment 7 Petr Uzel 2010-11-25 09:03:50 UTC
(In reply to comment #6)
> New package is in openSUSE:Factory:Contrib, please test.

Thanks, Petr!

> I suggest close this bug as soon as you confirm, that package works for you.

Closing now. 

@Axel: Please reopen if it doesn't work. Thanks

BTW fixed package for built for 11.3 is here:
http://download.opensuse.org/repositories/openSUSE:/Factory:/Contrib/openSUSE_11.3/x86_64/exiftran-2.07-4.1.x86_64.rpm
Comment 8 Axel Schwank 2010-11-28 21:29:52 UTC
Works for me, too, thank you all.
Regarding upstreamability:
I wonder how you fixed it, just took the files that are in fbi/jpeg from current libjpeg?
On the one hand, if I understand it right, LSB 4.0 requires that libjpeg has to be version 6.2, so if a distro wants to be LSB compliant, it has to use this version, hasn't it?
On the other hand, as stated above, fbi copies files from libjpeg 6.2 which include jpeglib.h locally but also include it from system directories. So code which uses a function inlcudes the definition of a data structure of that function from another location than the definition of that function. This is bad design and should never be done. I don't understand why transupp.c is copied anyway.
I'll try to discuss that with the author of fbi.
Comment 9 Christopher Hofmann 2011-02-16 15:17:00 UTC
For me this seems to be not really fixed.

Program received signal SIGSEGV, Segmentation fault.
transpose_critical_parameters (dstinfo=0x7fffffffcfc0) at jpeg/transupp.c:656

exiftran-2.07-5.4.x86_64 from openSUSE:Factory:Contrib
Comment 10 Petr Gajdos 2011-02-17 08:55:13 UTC
Christopher,

could you please try exiftran as soon as it is built?

Does it work for you now?

http://download.opensuse.org/repositories/openSUSE:/Factory:/Contrib/openSUSE_11.3/x86_64/
Comment 11 Petr Gajdos 2011-02-17 08:55:54 UTC
Fixed wrong needinfo.
Comment 12 Christopher Hofmann 2011-02-17 16:07:21 UTC
Works great with the set of photos I tried.
Thanks a lot.
Comment 13 Petr Gajdos 2011-02-18 07:23:35 UTC
Welcome and thanks too.