Twinside / Juicy.Pixels

Haskell library to load & save pictures

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Distortion (and possibly segfault) in decoding a certain JPEG

mtolly opened this issue · comments

Tracking down a segfault in my app led me to the decoding of a specific JPEG, which I think may be invoking out of bounds or uninitialized memory access.

test

(I don't think GitHub reencoded this, but I can upload it elsewhere if needed)

Doing a simple decode/encode with 3.3.6, I get:

test

I wasn't able to get a demo program to crash at all (which just does the decode/encode), and my own app only crashes some of the time, possibly dependent on the memory layout beforehand. So I'm not 100% sure that the decoding is causing the segfault, but it seems plausible based on the half-gibberish decoded result.

Ok, the jpeg format is a bit unusual, there is two vertical macroblock stacked, hence the proper rendering of half the lines of macro block

Thank you for such a quick fix! Crash seems to be resolved completely 😄