CR at end of buffer in epilog causes memory access violation.
switch (tok) {
case -XML_TOK_PROLOG_S:
if (defaultHandler) {
- eventEndPtr = end;
- reportDefault(parser, encoding, s, end);
+ eventEndPtr = next;
+ reportDefault(parser, encoding, s, next);
}
- /* fall through */
+ if (nextPtr)
+ *nextPtr = next;
+ return XML_ERROR_NONE;
case XML_TOK_NONE:
if (nextPtr)
- *nextPtr = end;
+ *nextPtr = s;
return XML_ERROR_NONE;
case XML_TOK_PROLOG_S:
if (defaultHandler)
return XML_TOK_INVALID;
}
case BT_CR:
- if (ptr + MINBPC(enc) == end)
+ if (ptr + MINBPC(enc) == end) {
+ *nextTokPtr = end;
return -XML_TOK_PROLOG_S;
+ }
/* fall through */
case BT_S: case BT_LF:
for (;;) {