I'm attaching a sample file.
This happens with textures that are bigger than 8k and with a 32bit float color depth. In the attached file you have a generated texture of 12k, if you press the bake button it will bake the AO of the cube, but when it starts adding the margin to the islands it crashes.
Funny fact, I was trying to bake a 16k texture, and it didn't crash... But I found out that it didn't crash because with a 16k texture it doesn't generate the margin at all for some reason...