Add new comment

You're using raw_width/raw

You're using raw_width/raw_height as image[] array size, so you're run out of array bounds.
The image array is sizes.iwidth * sizes.iheight in size.

More details:
raw image from sensor contains image itself and some 'masked pixels' (or optical black pixels, or 'masked frame') at the image edges..
The full sensor (raw data) size is raw_width x raw_height
The visible area size is sizes.width x sizes.height
The image array size is sizes.iwidth x sizes.iheight ( iwidth == width and iheight == height unless you set params.half_size to non-zero).

So you need to set your rwidth variable to sizes.iwidth (and same for rheight = sizes.iheight).

-- Alex Tutubalin @LibRaw LLC