fix: Dispose chunk data buffer in ReadChunkData when read is cancelled

Merged
CL
7d ago
+81-1

Fixes #3202.

ReadChunkData rents a buffer from the MemoryAllocator and then reads into it. If that read observes a cancellation request, the exception leaves ReadChunkData before the buffer is returned, so nothing disposes it.

Added a try/catch around the read: if it throws, dispose the buffer and rethrow. Added a regression test that forces a cancellation right at the IHDR chunk's data read and checks the rented buffer gets disposed either way, covering both Decode and Identify.