tweak overflow checks in jbig2dec and openjpeg