Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions Modules/expat/xmltok.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,16 +405,20 @@ utf8_toUtf8(const ENCODING *UNUSED_P(enc),
}

/* Avoid copying partial characters (from incomplete input). */
const char * const fromLimBefore = fromLim;
align_limit_to_full_utf8_characters(*fromP, &fromLim);
if (fromLim < fromLimBefore) {
input_incomplete = true;
{
const char * const fromLimBefore = fromLim;
align_limit_to_full_utf8_characters(*fromP, &fromLim);
if (fromLim < fromLimBefore) {
input_incomplete = true;
}
}

const ptrdiff_t bytesToCopy = fromLim - *fromP;
memcpy((void *)*toP, (const void *)*fromP, (size_t)bytesToCopy);
*fromP += bytesToCopy;
*toP += bytesToCopy;
{
const ptrdiff_t bytesToCopy = fromLim - *fromP;
memcpy((void *)*toP, (const void *)*fromP, (size_t)bytesToCopy);
*fromP += bytesToCopy;
*toP += bytesToCopy;
}

if (output_exhausted) // needs to go first
return XML_CONVERT_OUTPUT_EXHAUSTED;
Expand Down