i.e. malloc before setjmp.
Oops, I didn't even notice that the malloc size doesn't depend on the png library and could've been just moved before the setjmp
. But yeah, I fully agree with the…
In the first example just adding volatile like this works too:
Yup, that works too. But the reason I didn't do that and instead made a copy is because the saver has code like this:
…
Notice that the setjmp branch doesn't free the actually allocated pointer but instead free-s NULL that was assigned at the time of calling
setjmp
.
Also here's a version that keeps a…
Unless of course if you can actually demonstrate that there is a problem.
Okay, I did some small testing and it looks like this doesn't reliably work even on GCC. Here's a small test case:…
I think that the proper solution should be applied at all four locations.
Wasn't aware of jpeg doing longjmp as well. I'll look into that too.
(Sidenote: why is it so hard for libraries to…
@kw Noticed two other issues:
$ ./scrot -o /dev/full
libpng error: Write Error
scrot: failed to save image: /dev/full: No saver for file format
- libpng is doing stderr…
@kw Also just noticed, the tests should now allow y4m memory as well. Attached a patch.
Squashed the commits and hopefully the compiler warning should be fixed now too.
What version of GCC is that? I don't get that warning (gcc 12.1.1) and that's clearly false positive since the only case those variable aren't initialized is if the color space was mono. (But if…
Is it ready for merging?
Yeah, everything works fine as far as I tested. Wanted to remove dependency on libyuv as well, but that'll have to wait for some other day :)
Can I squash the…
Oops, forgot to fix this up. I'll look into what this is tomorrow :)
Sample multi-frame y4m: https://samples.mplayerhq.hu/yuv4mpeg2/example.y4m.bz2
And it would be nice to not rely on a library that AFAIK is not generally available in distros.
Going by repology, it's not packaged in a single distro. libyuv [seems decently pacakged](https:…
The y4m format doesn't seem too complicated. I might give it a go since I'm fairly free the next ~2weeks or so :)
This looks about right. So closing the issue.
Also - closing the fd seems dubious to me as well. But better to be consistent, I think. The caller just needs to dup the fd before passing it to…
A filename parameter would make imlib_save_image_fd useless, we're back to TOCTTOU baked into the API.
I don't think so. The "filename" in load_fd
is only used as an extension guess. The…
Either FILE *
or fd
should work fine for scrot's purposes.
Could just set SA_RESTART to avoid all the pain.
That's something that should be done on the application side. Altering global state behind the user's back is NOT something I like to see in…
I don't think poking into the current implementation details of one kernel and writing programs according to those details and a particular set of use cases is the right way to do things.…
I think the dir needs to be closed here, too: https://git.enlightenment.org/old/legacy-imlib2/src/commit/5c226954c114f1ced7027498fd2debd34bea08f2/src/lib/file.c#L226-L229
From what I understand, transforming the image before it's loaded should be ok.
What do you mean by "before it's loaded" - I'm not sure how an image can be transformed without loading…
I may now reveal my abysmal lack of knowledge about color spaces, gamut, ICC profiles, etc.
Same here for what it's worth :-)
Modifying loaders to deal with ICC profiles just to modify…
I think the original issue should've been pasted here, rather than just a link (some people read these issues via email notification and it's not convineient to open a webbrowser just to follow a…