GreycLab / CImg

The CImg Library is a small and open-source C++ toolkit for image processing
http://cimg.eu
Other
1.48k stars 282 forks source link

Bad printf-style arguments in warning message #337

Closed aachrisg closed 2 years ago

aachrisg commented 2 years ago

I crashed when saving a PNG without of range values, because of this warning message if (stmin<0 || (bytes_per_pixel==1 && stmax>=256) || stmax>=65536) cimg::warn(_cimg_instance "save_png(): Instance has pixel values in [%g,%g], probable type overflow in file '%s'.", cimg_instance, filename,stmin,stmax);

It has the printf arguments out of order (filename should be last), causing it to treat a float as a char const *.

Trivial fix, obviously :-)

dtschump commented 2 years ago

Thanks for reporting ! It is always nice to get feedback and be able to improve CImg, even a little bit :)