rem: else if (pos < bufEnd && buf[pos+1] == '\n') {
add: else if (pos+1 < bufEnd && buf[pos+1] == '\n') {
context: void DwEntityParser::Parse(){    const char* buf = mString.data();    size_t bufEnd = mString.length();    size_t pos = 0;    size_t headersStart = 0;    size_t headersLength = 0;    size_t lineStart = pos;    DwBool isHeaderLine = DwFalse;    // If first character is a LF (ANSI C or UNIX)    // or if first two characters are CR LF (MIME or DOS),    // there are no headers.    if (pos < bufEnd && buf[pos] != '\n'        && ! (buf[pos] == '\r' && pos+1 < bufEnd && buf[pos+1] == '\n')) {        while (pos < bufEnd) {            // End of line marked by LF            if (buf[pos] == '\n') {                ++pos;                if (!isHeaderLine) {                    pos = lineStart;                    break;                }                // Check for LF LF                else if (pos < bufEnd && buf[pos+1] == '\n') {                    break;                }                lineStart = pos;                isHeaderLine = DwFalse;            }            // End of line marked by CRLF            else if (buf[pos] == '\r' && pos+1 < bufEnd                && buf[pos+1] == '\n') {                pos += 2;                if (!isHeaderLine) {                    pos = lineStart;                    break;                }                // Check for CR LF CR LF                else if (pos+1 < bufEnd && buf[pos] == '\r'                    && buf[pos+1] == '\n') {                    break;                }                lineStart = pos;                isHeaderLine = DwFalse;            }            // End of line marked by CRLF            else if (buf[pos] == '\r' && pos+1 < bufEnd                && buf[pos+1] == '\n') {                pos += 2;                if (!isHeaderLine) {                    pos = lineStart;                    break;                }                // Check for CR LF CR LF                else if (pos+1 < bufEnd && buf[pos] == '\r'                    && buf[pos+1] == '\n') {                    break;                }                lineStart = pos;                isHeaderLine = DwFalse;            }            else if (buf[pos] == ':') {                isHeaderLine = DwTrue;                ++pos;            }            else if (pos == lineStart &&                (buf[pos] == ' ' || buf[pos] == '\t')) {                isHeaderLine = DwTrue;                ++pos;                            }            else {                ++pos;            }        }    }    headersLength = pos;    mHeaders = mString.substr(headersStart, headersLength);    // Skip blank line    // LF (ANSI C or UNIX)    if (pos < bufEnd && buf[pos] == '\n') {        ++pos;    }    // CR LF (MIME or DOS)    else if (pos < bufEnd && buf[pos] == '\r'        && pos+1 < bufEnd && buf[pos+1] == '\n') {        pos += 2;    }    size_t bodyStart = pos;    size_t bodyLength = mString.length() - bodyStart;    mBody = mString.substr(bodyStart, bodyLength);}