This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 143090 - saving and opening xpm files take an extraordinary amount of time
saving and opening xpm files take an extraordinary amount of time
Status: CLOSED UPSTREAM
Product: Red Hat Enterprise Linux 2.1
Classification: Red Hat
Component: gimp (Show other bugs)
2.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Nils Philippsen
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-12-16 09:43 EST by John Poelstra
Modified: 2007-11-30 17:06 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-12-17 05:07:12 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description John Poelstra 2004-12-16 09:43:48 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5)
Gecko/20041111 Firefox/1.0

Description of problem:
In the process of verifying
http://porkchop.redhat.com/errata/showrequest.cgi?advisory=2004%3A610
I found the following problem.

I opened gimp and saved a 160K jpg file as an xpm file which saved as
7meg.

After saving the file it took approximately 15 minutes to re-open the
file.  This was a on a system w/ 2gig of ram and 3 CPU's

Version-Release number of selected component (if applicable):
XFree86-4.1.0-64.EL

How reproducible:
Always

Steps to Reproduce:
1. Save jpg file as an xpm
2. Attempt to open the xpm
3. 
    

Actual Results:  It takes a very long time for the file to open.
Considering the size and strength of the system it should open very
quickly.

Expected Results:  The file should open reasonably fast

Additional info: Marking this bug as a security item because is
related to an outstanding errata.
Comment 1 John Poelstra 2004-12-16 09:47:54 EST
this is the image that I converted to xpm with gimp
http://www.lns.cornell.edu/~seb/celestia/carina-earth.jpg
Comment 2 Mark J. Cox (Product Security) 2004-12-16 09:50:32 EST
Is this a regression (and hence due to the xpm security fixes)?
Comment 3 John Poelstra 2004-12-16 10:56:15 EST
Running XFree86-4.1.0-62.EL I see the same behavior as
XFree86-4.1.0-64.EL.  Thus, it *may* be reasonable to assume that the
security fix did not cause the problem?
Comment 4 John Poelstra 2004-12-16 10:58:55 EST
I see the same behavior on i386 and ia64... both of which are very
powerful systems.
Comment 5 John Poelstra 2004-12-16 15:01:13 EST
Tried with a smaller jpg at bressers' suggestion and did not see any
problems with XFree86-4.1.0-62.EL with XFree86-4.1.0-64.E. Thus this
does not appear to be a regression, but instead a problem with
converting certain files to xpm.
Comment 6 Mike A. Harris 2004-12-16 16:08:09 EST
X does not convert JPGs to xpm or vice versa.  Reassign the bug
to the application you are using.  I suspect it is a performance
or optimization issue in that specific application, and probably
has nothing to do with X.
Comment 9 Nils Philippsen 2004-12-17 05:07:12 EST
People, XPM is not known as the most efficient image format on the planet for a
reason. It's not designed for large, photorealistic imagery but for small icons
and stuff with few colors (some people would say it isn't designed at all). It's
indexed, uncompressed and wrapped up in C syntax. Let's see how your image looks
in XPM format (abridged):

--- 8< ---
/* XPM */
static char * carina_earth_xpm[] = { 
"1600 1200 125796 3", 
"       c #C57250", 
".      c #C76D4B", 
"+      c #D16549", 
"@      c #CE644A", 
"#      c #C16B52",
[...]
" .     c #AF7F57",
"..     c #B3835B",
"+.     c #B4845C",
"@.     c #B2825A",
"#.     c #B8875F",
[...]
"  .    c #B85864",
". .    c #C16A7A",
"+ .    c #C2697B",
"@ .    c #C45A6E",
"# .    c #A53949",
[...]
"   .  +  @  #  $  %  &  *  =  -  ;  >  ,  '  )  !  ~  {  {  ]  ]  ^  ^  /  (  _
 :  <  [  [  }  |  1  2  3  4  5  6  7  8  9  0  a  b  c  d  e  f  g  h  i  j  k
 l  m  n  o  p  q  r  s  t  u  v  w  x  y  z  A  B  C  D  E  F  G  H  I  J  K  L
 M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  `  V   . .. +. @. .. #. $. %. &. *.
=. -. *. ;. >. ,. '. ). ). !. ~. {.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Y@ Z@ `@  # .# +#  #  #  #  # @# ## $# %# &# &#
*# *# =# =# -# ;# ># ,# ># ># '# )# ;# !# ~# ~# {# ]# ^# ^# /# /# (# (# (# (# _#
_# :# <# [# }# <# <# |# 1# 2# 3# 4# [# 5# <# /# 6# 7# 8# $# 9# 0# 0# 0# 0# a# a#
b# b# b# b# b# b# c# c# a# d# e# f# e# g# h# i# i# j# j# j# i# i# g# g# k# k# l#
l# m# n# o# p# q# r# L@ K@ K@ K@ s# t# L@ K@ u# u# u# u# M@ v# L@ t# L@ v# w# x#
y# z# A# A# B# C# D# E# F# G# H# I# J# J# K# L# M# N# O# P# Q# N# R# S# T# U# P#
P# O# S# T# V# W# X# Y# Z# `#  $ .$ +$ @$ @$ #$ #$ #$ $$ %$ &$ *$ =$ -$ ;$ >$ ,$
'$ '$ )$ !$ ~$ {$ ]$ ^$ /$ ($ _$ :$ <$ [$ }$ |$ 1$ 2$ 3$ 4$ 5$ 5$ 6$ 7$ 8$ 9$ 0$
a$ b$ c$ d$ e$ f$ g$ 8$ h$ i$ j$ k$ l$ m$ n$ o$ p$ q$ r$ s$ t$ u$ u$ v$ w$ x$ y$
z$ A$ B$ C$ D$ E$ F$ G$ F$ H$ H$ I$ H$ I$ G$ J$ K$ L$ M$ M$ N$ N$ N$ O$ P$ Q$ R$
S$ T$ U$ V$ W$ X$ X$ Y$ Y$ Z$ `$  % .% +% +% @% #% $% %% &% &% *% =% -% ;% >% ,%
'% ,% )% !% )% ~% {% {% ]% ]% ]% ]% ]% ]% ^% /% (% _% ^% :% <% [% }% |% |% |% 1%
1% 2% 2% #% #% 3% 3% 4% 5% 6% 7% 8% 9% 9% 0% a% b% b% c% d% e% f% g% h% i% j% j%
k% <% l% l% m% n% o% p% n% l% q% r% r% q% s% k% s% J  t% u% v% v% w% x% y% z% A%
B% y% C% D% E% F% F% G% G% G% G% x+ x+ H% I% I% J% J% K% K% K% K% L% M% N% N% M%
O% L% u+ w+ x+ y+ P% Q% R% S% T% U% U% V% W% X% X% Y% Z% `% `% `% `% `% Z% Z%  &
Z% .& +& @& #& @& $& %& && *& =& -& -& ;& ;& >& ,& '& )& !& !& ~& ~& {& ]& ^& ^&
^& /& (& _& :& <& [& }& |& 1& 2& 1& 3& 4& 5& 6& 5& 5& 7& 8& 7& 7& 7& 7& 7& 7& 7&
7& 6& 9& 0& 0& a& b& c& d& e& f& g& h& i& j& j& k& l& m& n& o& p& p& p& q& q& o&
n& r& r& n& q& p& s& t& u& v& w& x& y& y& z& A& B& C& D& E& F& G& H& I& J& K& L&
M& N& N& O& P& Q& R& S& T& S& U& V& W& X& Y& Z& `&  *  * .* +* @* #* #* @* $* %*
&* ** =* =* -* ;* >* ,* '* )* !* ~* {* ]* ^* /* (* _* :* <* [* }* |* 1* 2* 2* 3*
4* 5* 5* 6* 4* 7* 8* 9* 0* a* b* c* d* e* f* g* h* i* j* k* l* m* n* o* p* q* r*
s* 7* 7* t* u* u* v* w* x* y* z* A* B* C* D* h* E* F* E* |* G* E* H* C* F* I* J*
K* L* M* N* O* P* Q* R* S* T* U* U* V* W* X* Y* <* Z* Z* `*  = .= += &* @= #= $=
%= %= &= *= == -= ;= >= ,= '= )= != ~= -= ;= ~= {= ~= ,= ]= ^= /= (= _= := <= [=
}= |= 1= 2= 3= 4= 5= 6= 7= 8= 9= 0= a= b= c= d= d= e= f= g= h= i= i= j= k= l= m=
n= o= p= q= r= s= t= u= v= v= w= x= x= y= z= A= B= C= D= E= F= G= H= I= J= K= L=
M= N= O= P= Q= R= S= T= U= V= V= W= X= Y= Z= `=  - .- .- +- @- #- $- %- &- *- *-
#- =- -- ;- >- ,- >- '- <* o* )- !- ~- {- ]- ^- /- (- _- :- <- [- }- |- 1- 2- 3-
4- 5- 5- 6- 6- 7- a= 8- 9- 0- a- b- c- d- e- f- g- h- i- j- k- l- k- m- n- o- p-
q- r- s- t- u- v- w- x- y- z- A- m* B- C- D- E- F- G- H- I- J- J- K- L- M- N- O-
P- Q- Q- R- R- S- T- U- V- W- X- Y- Z- `-  ; .; +; @; #; $; %; &; *; =; -; ;; ;;
>; -; >; ;; ;; ,; ;; >; '; ); !; ~; {; ]; ^; /; /; /; (; ^; _; :; (; ^; /; :; <;
[; }; |; 1; 2; 3; 4; 5; 6; 7; 8; 9; 0; a; b; c; c; d; e; f; f; g; h; i; j; k; l;
m; n; o; p; q; r; s; t; u; v; w; x; y; z; A; B; C; D; E; F; G; H; I; J; K; L; M;
N; O; P; Q; R; S; T; U; V; W; X; Y; Z; `;  > .> +> @> #> $> %> &> &> *> => -> ;>
>> ,> '> )> !> ~> {> ]> ^> /> (> _> :> <> [> }> |> 1> 2> 3> 4> 5> 6> 7> 8> 9> 0>
a> b> c> d> e> f> g> h> i> j> k> l> m> n> o> p> q> r> s> t> e> u> v> w> x> y> z>
A> B> C> D> E> F> G> H> I> J> K> L> M> K> N> O> P> Q> R> S> T> U> x> U> V> W> X>
Y> Z> `>  , ., 3> +, @, #, $, %, &, *, =, -, ;, >, ,, ', ), ', !, ~, {, ], ^, /,
(, _, :, <, [, }, |, S> |, }, [, 1, 2, 2, 2, 3, X; 4, 4, 5, 6, 7, 8, 9, 0, a, a,
a, a, 0, b, c, d, 6, 6, 6, ",
[...]
--- >8 ---

So you've got a C syntax string array that needs to be parsed up -- securely
mind that, you don't know where the image came from -- where you don't know
right away how many characters (1, 2 or 3) represent one pixel. Taking into
account the dimensions of the image and the number of colors used (over 120000)
it doesn't surprise me at all that it takes a long time to load, the algorithm
also isn't parallelized, so you could have 512 CPUs and it wouldn't make a
difference. Trying to load the image and stracing the xpm plugin showed that it
takes very long (a second or more) to load one line of the file...

You could argue that there were room for optimization and there probably is, but
as you're using the tool XPM for a job way outside its specification envelope, I
doubt that it's worth the effort. I'm closing this UPSTREAM so if you can
convince the upstream developers to optimize this case and they come up with a
patch or you come up with one by yourself, I'd be happy to include it (though
that'd have to be against gimp-2.2pre, not gimp-1.x).

Note You need to log in before you can comment on or make changes to this bug.