avcodec/mjpegdec: Check index in ljpeg_decode_yuv_scan() before using it