[Poppler-bugs] [Bug 63067] Misuse of setjmp in DCTStream

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Apr 3 17:29:49 PDT 2013


https://bugs.freedesktop.org/show_bug.cgi?id=63067

--- Comment #2 from rodrigo <rodrigorivascosta at gmail.com> ---
(In reply to comment #1)
> The man page I have here does not say that, do you have a link to the POSIX
> or C spec at hand?

You can read what POSIX says at [0].

The C99 specification is at [1] (section 7.3.1.1) but the wording is almost
identical, as this function is 'ISO C aligned'.

Also, many linux distributions have a package named manpages-posix or the like.
If you have it installed you can request the POSIX version of the man page by
running:

$ man 3p setjmp

But now that I read the 'longjmp(3p)' [2] with more detail, I think that there
are bigger problems ahead... Note the following quote:

> if [when calling longjmp] the function containing the invocation of setjmp() has terminated execution [...] the behavior is undefined.

And I think that this happens a lot, as `setjmp` is called from a lot of helper
functions. I think that the right thing to do should be to call it only once at
the beginning of the main decompression function. The problem is that such a
call cannot be encapsulated into the DCTStream class, it had to be done from
the user code, and that is not very nice.

[0]: http://pubs.opengroup.org/onlinepubs/009696799/functions/setjmp.html
[1]: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf 
[2]: http://pubs.opengroup.org/onlinepubs/009696799/functions/longjmp.html

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/poppler-bugs/attachments/20130404/ab18f888/attachment.html>


More information about the Poppler-bugs mailing list