nsCRT::memmove(src->decoder->mBackBuffer + src->decoder->mBackBufferLen, src->pub.next_input_byte, src->pub.bytes_in_buffer);
memmove(src->decoder->mBackBuffer + src->decoder->mBackBufferLen, src->pub.next_input_byte, src->pub.bytes_in_buffer);
fill_input_buffer (j_decompress_ptr jd){  decoder_source_mgr *src = (decoder_source_mgr *)jd->src;  unsigned char *new_buffer = (unsigned char *)src->decoder->mBuffer;  PRUint32 new_buflen = src->decoder->mBufferLen;  PRUint32 bytesToSkip = src->decoder->mBytesToSkip;  switch(src->decoder->mFillState) {  case READING_BACK:    {      if (!new_buffer || new_buflen == 0)        return PR_FALSE; /* suspend */      src->decoder->mBufferLen = 0;      if (bytesToSkip != 0) {        if (bytesToSkip < new_buflen) {          /* All done skipping bytes; Return what's left. */          new_buffer += bytesToSkip;          new_buflen -= bytesToSkip;          src->decoder->mBytesToSkip = 0;        } else {          /* Still need to skip some more data in the future */          src->decoder->mBytesToSkip -= (size_t)new_buflen;          return PR_FALSE; /* suspend */        }      }      src->decoder->mBackBufferUnreadLen = src->pub.bytes_in_buffer;      src->pub.next_input_byte = new_buffer;      src->pub.bytes_in_buffer = (size_t)new_buflen;      src->decoder->mFillState = READING_NEW;      return PR_TRUE;    }    break;  case READING_NEW:    {      if (src->pub.next_input_byte != src->decoder->mBuffer) {        /* Backtrack data has been permanently consumed. */        src->decoder->mBackBufferUnreadLen = 0;        src->decoder->mBackBufferLen = 0;      }      /* Save remainder of netlib buffer in backtrack buffer */      PRUint32 new_backtrack_buflen = src->pub.bytes_in_buffer + src->decoder->mBackBufferLen;      /* Make sure backtrack buffer is big enough to hold new data. */      if (src->decoder->mBackBufferSize < new_backtrack_buflen) {        /* Round up to multiple of 16 bytes. */        PRUint32 roundup_buflen = ((new_backtrack_buflen + 15) >> 4) << 4;        if (src->decoder->mBackBufferSize) {            src->decoder->mBackBuffer =          (JOCTET *)PR_REALLOC(src->decoder->mBackBuffer, roundup_buflen);        } else {          src->decoder->mBackBuffer = (JOCTET*)PR_MALLOC(roundup_buflen);        }        /* Check for OOM */        if (!src->decoder->mBackBuffer) {#if 0          j_common_ptr cinfo = (j_common_ptr)(&src->js->jd);          cinfo->err->msg_code = JERR_OUT_OF_MEMORY;          my_error_exit(cinfo);#endif        }                  src->decoder->mBackBufferSize = (size_t)roundup_buflen;        /* Check for malformed MARKER segment lengths. */        if (new_backtrack_buflen > MAX_JPEG_MARKER_LENGTH) {          my_error_exit((j_common_ptr)(&src->decoder->mInfo));        }      }      /* Copy remainder of netlib buffer into backtrack buffer. */      nsCRT::memmove(src->decoder->mBackBuffer + src->decoder->mBackBufferLen,                     src->pub.next_input_byte,                     src->pub.bytes_in_buffer);      /* Point to start of data to be rescanned. */      src->pub.next_input_byte = src->decoder->mBackBuffer + src->decoder->mBackBufferLen - src->decoder->mBackBufferUnreadLen;      src->pub.bytes_in_buffer += src->decoder->mBackBufferUnreadLen;      src->decoder->mBackBufferLen = (size_t)new_backtrack_buflen;          src->decoder->mFillState = READING_BACK;      return PR_FALSE;    }    break;  }  return PR_FALSE;}