fix buffer overrun in jpeg decoder