Handle unreachable return locations

At some points we check m_reenter flag for return. However this flag can
never be true at these points. Therefore body of the check is never
executed. This commit excludes the body from test coverage, removes the
nextPtr update (since we faced an error, no need to update it) and
lastly makes them return XML_ERROR_UNEXPECTED_STATE as a safety net.
This commit is contained in:
Berkay Eren Ürün 2025-01-28 11:13:15 +01:00
parent e41a398e3f
commit c25f0cef93

View file

@ -2902,8 +2902,7 @@ externalEntityInitProcessor3(XML_Parser parser, const char *start,
return XML_ERROR_ABORTED;
case XML_PARSING:
if (parser->m_reenter) {
*endPtr = next;
return XML_ERROR_NONE;
return XML_ERROR_UNEXPECTED_STATE; // LCOV_EXCL_LINE
}
/* Fall through */
default:
@ -4342,8 +4341,7 @@ doCdataSection(XML_Parser parser, const ENCODING *enc, const char **startPtr,
return XML_ERROR_ABORTED;
case XML_PARSING:
if (parser->m_reenter) {
*nextPtr = next;
return XML_ERROR_NONE;
return XML_ERROR_UNEXPECTED_STATE; // LCOV_EXCL_LINE
}
/* Fall through */
default:;
@ -5962,8 +5960,7 @@ epilogProcessor(XML_Parser parser, const char *s, const char *end,
return XML_ERROR_ABORTED;
case XML_PARSING:
if (parser->m_reenter) {
*nextPtr = next;
return XML_ERROR_NONE;
return XML_ERROR_UNEXPECTED_STATE; // LCOV_EXCL_LINE
}
/* Fall through */
default:;