Skip to content

PhotoDemon-nightly: Adjustments > Brightness and Contrast: fix potential overflow error

Latest

Choose a tag to compare

@barionleg barionleg released this 12 Apr 11:44
· 210 commits to main since this release
42aa19c
Relates to #452 .  Thank you to @opsimathic for catching and reporting!

Brightness and contrast are possibly the oldest adjustments in PhotoDemon (20+ years old at this point), making this a very old bug!

When calculating average luminance for sampled contrast, I had mistakenly typed integer divide instead of floating-point divide and this can produce an overflow for images whose net brightness exceeds MAX_INT (~4.2e9).

Problem now solved; updated nightly incoming shortly...