Skip to content

Commit

Permalink
parser: Fix xmlInputSetEncodingHandler again
Browse files Browse the repository at this point in the history
Short-lived regression.
  • Loading branch information
nwellnhof committed Jul 11, 2024
1 parent 8af55c8 commit aa6aec1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions parserInternals.c
Original file line number Diff line number Diff line change
Expand Up @@ -1299,6 +1299,7 @@ xmlInputSetEncodingHandler(xmlParserInputPtr input,
xmlParserInputBufferPtr in;
xmlBufPtr buf;
int nbchars;
int code = XML_ERR_OK;

if ((input == NULL) || (input->buf == NULL)) {
xmlCharEncCloseFunc(handler);
Expand Down Expand Up @@ -1348,7 +1349,7 @@ xmlInputSetEncodingHandler(xmlParserInputPtr input,
/*
* Is there already some content down the pipe to convert ?
*/
if (input->end > input->cur) {
if (input->end > input->base) {
size_t processed;

/*
Expand All @@ -1361,12 +1362,13 @@ xmlInputSetEncodingHandler(xmlParserInputPtr input,
in->rawconsumed = processed;

nbchars = xmlCharEncInput(in);
xmlBufResetInput(in->buffer, input);
if (nbchars < 0)
return(in->error);
code = in->error;
}

return(XML_ERR_OK);
xmlBufResetInput(in->buffer, input);

return(code);
}

/**
Expand Down

0 comments on commit aa6aec1

Please sign in to comment.