Fix the bug that crash jpeg decoding code