Nick Wellnhofer
144ed959a5
parser: Move xmlSaturatedAdd to private header
2025-07-31 14:23:23 +02:00
Nick Wellnhofer
e3daef5c78
parser: Fix xmlSaturatedAddSizeT argument type
...
This is only used for entity size accounting. The bug only affected
platforms where sizeof(long) != sizeof(size_t) and was probably
harmless.
2025-07-31 14:23:23 +02:00
Nick Wellnhofer
7a41b18c62
parser: Remove xmlHaltParser
...
Always halt the parser on resource limit and entity loop errors and
remove the remaining calls which seem unnecessary.
2025-07-31 14:23:23 +02:00
Nick Wellnhofer
bd9d5e39ec
parser: Fix handling of invalid char refs in recovery mode
...
Revert to the old behavior which handles invalid char refs more
gracefully. Probably regressed with 37c6618b
(version 2.13.0).
2025-07-09 14:58:26 +02:00
Nick Wellnhofer
6c796b3792
doc: Misc fixes
2025-07-09 13:17:39 +02:00
Nick Wellnhofer
56a767ed58
doc: Small fix
2025-06-28 15:21:44 +02:00
Nick Wellnhofer
0d52684e31
parser: Don't set dict limit when setting options
...
This is done in xmlCtxtInitializeLate.
2025-06-28 15:21:44 +02:00
Nick Wellnhofer
1b737cc810
parser: Another fix to ]]> detection in push parser
...
The original fix for issue #850 in commit 9efe1414
was incomplete.
2025-06-28 15:21:20 +02:00
Nick Wellnhofer
7c91385040
parser: Remove unnecessary dict checks when freeing strings
...
The following strings are never allocated from a dict:
- xmlParserCtxt.version
- xmlParserCtxt.encoding
- xmlParserCtxt.extSubURI
- xmlParserCtxt.extSubSystem
- xmlDoc.version
- xmlDoc.encoding
- xmlDoc.URL
- xmlDTD.ExternalID
- xmlDTD.SystemID
- xmlID.value
Also make the struct members point to non-const chars to avoid casts
when freeing.
2025-06-23 22:59:31 +02:00
Nick Wellnhofer
e7802738c6
parser: Don't load external content if only XML_SKIP_IDS is set
...
At some point, the `loadsubset` member was augmented to also control
handling of ID attributes in addition to loading of external DTDs. These
two features are unrelated and shouldn't have been mixed. This mistake
was probably inspired by the misnamed XML_DETECT_IDS flag. As a side
effect, setting XML_SKIP_IDS always enabled loading of external DTDs and
parameter entities.
This change makes it possible to ignore IDs without loading external
content. This is a deliberate API change that improves security and is
unlikely to affect users.
This also makes sure that the new XML_PARSE_SKIP_IDS option doesn't
enable unsafe behavior.
2025-06-22 15:18:43 +02:00
Nick Wellnhofer
1c96d5ef51
parser: Add comment in xmlStopParser
2025-06-22 14:31:26 +02:00
Nick Wellnhofer
a4d25b3d93
doc: Small fixes
2025-06-22 14:31:26 +02:00
Michael Mann
cf4f967266
Add XML_PARSE_SKIP_IDS to replace XML_SKIP_IDS
...
Mark loadset member as deprecated
Fixes #873
2025-06-22 08:03:34 -04:00
Nick Wellnhofer
a3992815b3
parser: Fix buffer overflow when parsing PublicIds
...
Regressed with 8231c0366
and 30665ae4
.
2025-06-12 13:51:37 +02:00
Nick Wellnhofer
30665ae4d1
parser: Fix parsing of PublicIds and VersionNums
...
Regressed in 8231c0366
.
Fixes #940 .
2025-06-11 18:36:50 +02:00
Nick Wellnhofer
416da89d0b
html: Make htmlCtxtReset call xmlCtxtReset
...
The two implementations shouldn't diverge.
2025-06-08 14:22:32 +02:00
Alex Richardson
7e4247b278
parser: use XML_INT_TO_PTR when storing integers as pointers
...
This fixes warnings when using a CHERI-aware toolchain.
2025-06-06 12:11:54 -07:00
Nick Wellnhofer
2b6b3945f2
Revert "SAX1: Align handling of default attributes with SAX2"
...
This reverts commit db65b2fc51
.
This didn't check for duplicate default attributes.
2025-06-03 16:21:56 +02:00
Nick Wellnhofer
30375877d9
parser: Fix custom SAX parsers without cdataBlock handler
...
Use characters handler if cdataBlock handler is NULL.
Regressed with 57e4bbd8
. Should fix #934 .
2025-06-03 16:21:48 +02:00
Nick Wellnhofer
479f26f92f
regexp: Remove unfinished reimplementation
...
This was never enabled.
2025-06-03 00:28:16 +02:00
Nick Wellnhofer
0f8543e11d
parser: Fix error reporting in xmlSkipBlankCharsPEBalanced
...
Short-lived regression.
2025-06-02 14:19:01 +02:00
Nick Wellnhofer
6a6a46f017
doc: Fix autolink errors
...
Fix links, remove links to internal functions.
2025-05-28 16:02:41 +02:00
Nick Wellnhofer
7bd8d1d9cc
doc: Prefix autolinks with '#'
...
Use `#func` instead of `func()` to ignore parameters and make all
autolinks work.
2025-05-28 16:01:52 +02:00
Nick Wellnhofer
8baa5de182
parser: Avoid integer overflow in xmlParseCharDataInternal
...
`nbchar` could overflow with larger than 2GB memory buffers which some
new APIs allow. This shouldn't affect memory safety.
Limit maximum amount of bytes passed to character callback to
XML_MAX_ITEMS (1e9).
2025-05-27 20:03:13 +02:00
Nick Wellnhofer
ab06bfa1f6
parser: Fix error return in xmlParseElementContentDecl
...
Avoid internal error later in xmlValidBuildAContentModel after
2a60ca06c
.
Also avoids some unnecessary error messages.
2025-05-26 16:51:59 +02:00
Nick Wellnhofer
4dc44c83ab
parser: Rework entity boundary check for element content
...
Only use depth of input stack. This makes the input ID unused
internally.
2025-05-25 14:26:30 +02:00
Nick Wellnhofer
74ea6b483c
parser: Start using input depth for entity boundary check
...
Now that we make sure that PEs starting markup won't be popped
implicitly, it's enough to check that no new entities are on the stack
when checking boundaries.
2025-05-25 14:26:30 +02:00
Nick Wellnhofer
db65b2fc51
SAX1: Align handling of default attributes with SAX2
...
The SAX1 parser is legacy code, but it seems more maintainable to align
it with SAX2.
2025-05-25 14:26:30 +02:00
Nick Wellnhofer
e4cbc295fa
parser: Check attribute normalization standalone constraint
...
To fully implement "VC: Standalone Document Declaration", we have to
check for normalization changes caused by non-CDATA attribute types
declared externally.
Fixes #119 .
2025-05-25 14:26:30 +02:00
Nick Wellnhofer
682195c869
parser: Fix "Proper Declaration/PE Nesting" validity constraint
...
Now that we handle "WFC: PE Between Declarations" correctly, we can turn
"Proper Declaration/PE Nesting" from a WFC into VC as specified.
Fixes #118 .
2025-05-25 14:26:30 +02:00
Nick Wellnhofer
2f3655c9c3
parser: Pop PEs that start markup declarations explicitly
...
We currently only handle "Validity constraint: Proper Declaration/PE
Nesting", but we must detect "Well-formedness constraint: PE Between
Declarations" separately:
> The replacement text of a parameter entity reference in a DeclSep must
> match the production extSubsetDecl.
PEs in DeclSeps are PEs that start with a full markup declaration (or
another PE). These are handled in xmParse{Internal|External}Subset. We
set a flag on these PEs and don't close them implicitly in
xmlSkipBlankCharsPE. This will make unterminated declarations in such
PEs cause a parser error. The PEs are closed explicitly in
xmParse{Internal|External}Subset, the only location where they are
allowed to end.
2025-05-25 14:26:30 +02:00
Nick Wellnhofer
2a60ca06c0
valid: Don't check enum values
...
Rely on the parser to pass valid arguments.
2025-05-25 14:26:30 +02:00
Nick Wellnhofer
dd1961e0d8
valid: Skip more validity checks if not validating
2025-05-25 14:26:30 +02:00
Nick Wellnhofer
47aca2c6c9
parser: Only check validity contraints when validating
2025-05-19 20:07:54 +02:00
Nick Wellnhofer
172550d225
parser: Only validate EnumerationTypes when requested
...
This has quadratic behavior and is only a validity constraint.
2025-05-19 19:58:33 +02:00
Nick Wellnhofer
7008740a96
parser: Consolidate scanning of XML Names
...
Use new productions by default.
Fixes #194 .
Fixes #364 .
See #707 .
2025-05-19 19:58:33 +02:00
Nick Wellnhofer
657254a87f
parser: Factor out xmlIsNameCharNew/Old
2025-05-18 01:23:25 +02:00
Nick Wellnhofer
c5b45fbc07
doc: Misc fixes
2025-05-16 19:04:20 +02:00
Nick Wellnhofer
6f4b452742
parser: Stop using ctxt->linenumbers
...
I think this was used to avoid setting the `line` member before it was
added (20+ years ago).
2025-05-16 18:03:12 +02:00
Nick Wellnhofer
adfbeb7e08
doc: Stop using *Ptr typedefs in documentation
2025-05-16 18:03:12 +02:00
Nick Wellnhofer
a40f36e7f2
include: Stop using *Ptr typedefs in public headers
2025-05-16 18:03:12 +02:00
Nick Wellnhofer
442c1903af
doc: Fix some damage from automated conversions
...
Add some newlines, fix returns.
2025-05-11 20:29:25 +02:00
Nick Wellnhofer
ad390a5d14
parser: Set doc properties in endDocument SAX handler
2025-05-11 20:29:25 +02:00
Nick Wellnhofer
9bbffec568
doc: Move brief to top, params to bottom of doc comments
2025-05-06 19:51:38 +02:00
Nick Wellnhofer
1bf44f09ba
doc: Misc fixes to parser docs
2025-05-06 19:51:38 +02:00
Nick Wellnhofer
4a01087585
doc: Move parser option docs to enum
2025-05-06 19:51:38 +02:00
Nick Wellnhofer
cb1635a642
doc: Use @since command
2025-05-02 19:05:25 +02:00
Nick Wellnhofer
e78e05c990
doc: Fix autolinks to functions
...
Unfortunately, autolinks in .c files aren't converted by Doxygen for
some reason.
2025-05-02 17:45:31 +02:00
Nick Wellnhofer
f7c412874b
doc: Remove more comment block headers
2025-05-02 17:41:26 +02:00
Nick Wellnhofer
1eca6e3476
parser: Deprecate xmlClearParserCtxt
2025-05-02 13:33:35 +02:00