I occasionally run into segfaults when using jpeg-recompress -m smallfry on some images.
Explanation of the fix
This fix is required because in line 81 there is DVAL(j + 2) which is transformed into abs(old[j+2] - new[j+2]).
On the last iteration in this loop j will be equal width - 2, meaning we are accessing abs(old[width] - new[width]),
which in case of the last row of an image is beyond what was allocated.
I occasionally run into segfaults when using
jpeg-recompress -m smallfry
on some images.Explanation of the fix
This fix is required because in line 81 there is
DVAL(j + 2)
which is transformed intoabs(old[j+2] - new[j+2])
. On the last iteration in this loopj
will be equalwidth - 2
, meaning we are accessingabs(old[width] - new[width])
, which in case of the last row of an image is beyond what was allocated.