Special Gradient Map breaks Photoshop 25.1 and makes files unreadable
Warning! This is a serious bug. If you trigger this error in PS 25.1 it stops responding.
If you save the file with Gradient Map settings described below in a previous version of Photoshop, and try to open in 25.1 it shows "Could not open "file.psd" because of a program error." or the canvas stops refreshing.
Steps to reproduce (in Photoshop 25.1, 4K screen):
- Create an empty document, any size (let's say 50x50 px), 8-bit, RGB.
- Create new adjustment layer, Gradient Map
- Make sure you have "Navigator" panel opened - it makes reproducing this bug easier.
- Open Gradient Editor, choose "Foreground to Background" preset and click on the leftmost gradient point

- Click on the midpoint slider and type in 95 in the Location field

- Again, click on the leftmost color slider (black) and type in Location 80. Important - type in, don't use the mouse to drag the slider!

- Now comes the funny part. Using a mouse click on the rightmost color slider (white) and drag it over the black color slider, so that the location says 80. The funny part is that the location says 80 in three slightly different places.
Just to the right of the "real" 80 - the Navigator window shows white color:
Just on top of the "real" 80, the Navigator window shows gray color:

Just to the left of the "real" 80, the Navigator window shows black color:

- Make sure, you are in the state where the Navigator shows gray color.
- Click OK. CAUTION! Photoshop 25.1 will stop responding.
- Photoshop 25.0, and previous versions, work fine. But if you save such a file and open it in 25.1 you will get a program error and the file does not open at all.
Fun fact: internally, Photoshop stores locations as 16-bit integer from range 0...4096, but displays the value as 8-bit from range 0..100. That's why there can be many locations that maps back to the same displayed value. For the example above, the gradient map config was represented as:
[{
"csLocation": 3277,
"csMidpoint": 50,
"csModeOfColorToFollow": 0,
"csColors": [0, 0, 0, 0],
"nTransparenctStops": 0
},
{
"csLocation": 3282,
"csMidpoint": 95,
"csModeOfColorToFollow": 0,
"csColors": [65535, 65535, 65535, 0],
"nTransparenctStops": 0
}]
Note that 3277/4096*100=80.00488 and 3282/4096*100=80.12695, which are very close. (yep, I wrote a parser xD)
Expected result: it works xD
Version: Photoshop 25.1, Photoshop Beta 25.2 (works fine in <=25.0)
Platform and OS version: Windows 10, x64
