Crash when loading grayscale png
GIMP 2.99 master self built. Note this does not happen on 2.10.22.
Windows 10 Home, 64 bits.
g03n3p04.png from the png test suite crashes GIMP saying:
fatal error: unhandled exception
Several other images from that set, e.g.
g03n0g16.png show a warning:
GIMP Error Execution error for procedure 'gimp-image-set-color-profile': ICC profile validation failed: Color profile is not for grayscale color space
This warning seems to happen with most if not all grayscale png images from that set. It looks like it is caused by the recently introduced color profile creation in combination with gAMA and cHRM png chunks.
When disabling that part of the code the png images load without problems or warnings.
It seems that the color profile is also created for grayscale images instead of a grayscale profile or no profile. I'm not very familiar with color profiles so not sure what the best thing to do here is.