<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Misuse of setjmp in DCTStream"
href="https://bugs.freedesktop.org/show_bug.cgi?id=63067#c4">Comment # 4</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Misuse of setjmp in DCTStream"
href="https://bugs.freedesktop.org/show_bug.cgi?id=63067">bug 63067</a>
from <span class="vcard"><a class="email" href="mailto:Thomas.Freitag@alfa.de" title="Thomas Freitag <Thomas.Freitag@alfa.de>"> <span class="fn">Thomas Freitag</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=63067#c0">comment #0</a>)
<span class="quote">> According to POSIX and the C spec, `setjmp` should only be used as the
> "entire controlling expression" of a selection of iteration statement,
> possibly with `!` or `== 0` or similar.
>
> But in DCTStream.cc is the line:
>
> if (!setjmp(err.setjmp_buffer) && jpeg_read_header(&cinfo, TRUE) !=
> JPEG_SUSPENDED)</span >
This is NOT a iteration statement, iteration statements are "for", "while" and
similar!
<span class="quote">>
> If I'm not mistaken, that is undefined behavior. Not that it broke anything
> yet...
>
> Instead it should be:
>
> if (!setjmp(err.setjmp_buffer))
> {
> if (jpeg_read_header(&cinfo, TRUE) != JPEG_SUSPENDED)</span >
Okay, okay, the order of execution of an if condition is undefined in C/C++
(other than if Java, where You can count on that it will be done from left to
right). BUT I never see an c/c++ compiler which does it in another way.
But if we are puristic: Yes, it should be in that way!</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>