Fwd: Magick++ Bug Report

Hyrum Wright <[email protected]> Tue, 17 Feb 2015 19:32:12 -0500
Newsgroups gmane.comp.video.graphicsmagick.core
Message-ID <CAHik5tJJVp2zksSb0ferHd6Y1SeTs4LVn3xLd57AjS070+0OtA@mail.gmail.com>
--===============1224130525724453202==
Content-Type: multipart/alternative; boundary=001a113533724f051b050f51f3d3

--001a113533724f051b050f51f3d3
Content-Type: text/plain; charset=UTF-8

See below for a bug in ImageMagick that Dirk thinks may also be in
GraphicsMagick.

---------- Forwarded message ----------
From: Dirk Lemstra <[email protected]>
Date: Tue, Feb 17, 2015 at 6:28 PM
Subject: Re: Magick++ Bug Report
To: Hyrum Wright <[email protected]>


 Hyrum,

You might also want to contact the maintainer of GraphicsMagick. Their code
has the same issue.

Dirk

On 18-02-2015 00:07, Lexie Parsimoniae wrote:

From: Hyrum Wright <[email protected]>
Reply-To: Hyrum Wright <[email protected]>
X-Mailer: PHP/5.3.3
Origin: 72.14.228.1

On the 6.9.0 branch, Magick++/lib/Blob.cpp and Magick++/lib/Image.cpp don't
do proper locking.  Specifically, the line of the form:

  Lock(&_imgRef->_mutexLock);

or

  Lock(&_blobRef->_mutexLock);

are wrong.  These lines look like they are attempting to use RAII to ensure
the mutex is unlocked when the relevant functions return, but instead these
lines create a *temporary* unnamed lock that is immediately released.  The
proper fix looks something like:

  Lock lock(&_imgRef->_mutexLock);

I count 6 instances of this bug in Blob.cpp and 8 in Image.cpp.  These were
found using the misc-unused-raii check from clang-tidy.

It doesn't look like this problem exists on trunk, since the locking has
been moved to BlobRef.cpp and ImageRef.cpp and made manual.

-Hyrum

--001a113533724f051b050f51f3d3
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>See below for a bug in ImageMagick that Dirk thinks m=
ay also be in GraphicsMagick.</div><br><div class=3D"gmail_quote">---------=
- Forwarded message ----------<br>From: <b class=3D"gmail_sendername">Dirk =
Lemstra</b> <span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]">dirk@=
lemstra.org</a>&gt;</span><br>Date: Tue, Feb 17, 2015 at 6:28 PM<br>Subject=
: Re: Magick++ Bug Report<br>To: Hyrum Wright &lt;<a href=3D"mailto:hwright=
@google.com">[email protected]</a>&gt;<br><br><br><u></u>
<div>
<p>Hyrum,</p>
<p>You might also want to contact the maintainer of GraphicsMagick. Their c=
ode has the same issue.</p><span class=3D"">
<p>Dirk</p>
<p>On 18-02-2015 00:07, Lexie Parsimoniae wrote:</p>
<blockquote type=3D"cite" style=3D"padding-left:5px;border-left:#1010ff 2px=
 solid;margin-left:5px">
<div dir=3D"ltr">From: Hyrum Wright &lt;<a href=3D"mailto:[email protected]=
m" target=3D"_blank">[email protected]</a>&gt;<br>Reply-To: Hyrum Wright &=
lt;<a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]=
om</a>&gt;<br>X-Mailer: PHP/5.3.3<br>Origin: 72.14.228.1<br><br>On the 6.9.=
0 branch, Magick++/lib/Blob.cpp and Magick++/lib/Image.cpp don&#39;t do pro=
per locking.=C2=A0 Specifically, the line of the form:<br><br>=C2=A0 Lock(&=
amp;_imgRef-&gt;_mutexLock);<br><br>or<br><br>=C2=A0 Lock(&amp;_blobRef-&gt=
;_mutexLock);<br><br>are wrong.=C2=A0 These lines look like they are attemp=
ting to use RAII to ensure the mutex is unlocked when the relevant function=
s return, but instead these lines create a *temporary* unnamed lock that is=
 immediately released.=C2=A0 The proper fix looks something like:<br><br>=
=C2=A0 Lock lock(&amp;_imgRef-&gt;_mutexLock);<br><br>I count 6 instances o=
f this bug in Blob.cpp and 8 in Image.cpp.=C2=A0 These were found using the=
 misc-unused-raii check from clang-tidy.<br><br>It doesn&#39;t look like th=
is problem exists on trunk, since the locking has been moved to BlobRef.cpp=
 and ImageRef.cpp and made manual.<br><br>-Hyrum<br><br></div>
</blockquote>
</span></div>
</div><br></div>

--001a113533724f051b050f51f3d3--


--===============1224130525724453202==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
--===============1224130525724453202==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Graphicsmagick-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/graphicsmagick-core

--===============1224130525724453202==--