Commit Graph

187 Commits

Author SHA1 Message Date
Eduard Permyakov 2d33f406c9 xmllite: Don't lose terminating character when shrinking buffer.
The utf16 buffer is expected to be terminated by a '0' character.
Flawed buffer shrinking logic would move the buffer contents but
forget about the terminating character, which could cause reading
junk past the end of the buffer contents.

Signed-off-by: Eduard Permyakov <epermyakov@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-10 19:55:54 +02:00
Paul Gofman 82d69d8ba9 xmllite: Avoid out of bounds access in readerinput_get_utf8_convlen().
And consequently in readerinput_shrinkraw().

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-15 17:31:33 +02:00
Michael Stefaniuc b0c4d51588 xmllite: Drop superfluous casts to self.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-04 09:38:42 +01:00
Michael Stefaniuc c3aa9defbb xmllite: Use a string literal for an empty string.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-04 09:38:40 +01:00
Nikolay Sivov 6b5bf48c51 xmllite/reader: Use wide-char string literals.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-18 20:28:05 +01:00
Jacek Caban 950d960eed xmllite: Update current pointer after reader_skipn call.
The buffer may be reallocated.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-07 14:09:36 +01:00
Alexandre Julliard 705d089259 xmllite: Build with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-27 22:20:05 +02:00
Nikolay Sivov 4c779c07bd xmllite/writer: Implement WriteDocType().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-11-02 15:18:02 +01:00
Nikolay Sivov 69b2ed368d xmllite/writer: Validate local name and prefix in WriteElementString().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-10 16:45:01 +02:00
Nikolay Sivov fc62dac4dc xmllite/reader: Fix compiler warning.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-05 19:05:51 +02:00
Nikolay Sivov 4a78b4da41 xmllite: Use ARRAY_SIZE macro for reader too.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-02-22 09:43:13 +01:00
Nikolay Sivov 49a57bcaba xmllite/writer: Improve handling of the output with invalid encoding.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-08-03 11:50:49 +02:00
Nikolay Sivov b06dd7d804 xmllite/reader: Added a helper for setting current attribute cursor.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-07-21 14:59:54 +02:00
Nikolay Sivov be5679108c xmllite/reader: Implement MoveToAttributeByName().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-07-21 14:59:51 +02:00
Nikolay Sivov d1e14576bb xmllite/reader: Fix IID argument handling in CreateXmlReader().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-11 14:59:29 +02:00
Nikolay Sivov ef023c3fd6 xmllite: Recognize us-ascii encoding.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-03 10:52:39 +02:00
Jacek Caban 9506e7da5e xmllite: Return local name stored in namespace for prefixed namespace attribute values.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-31 19:13:34 +02:00
Jacek Caban 1b9b791c41 xmllite: Allocate value in reader_add_attr.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-31 19:13:30 +02:00
Jacek Caban daf0504570 xmllite: Allow reading from allocated strings in ReadValueChunk.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-31 19:13:27 +02:00
Jacek Caban f86222268f xmllite: Store allocated copy of local name in attribute struct and use that instead of StringValue_LocalName.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-31 19:13:21 +02:00
Jacek Caban 004d615f83 xmllite: Don't use StringValue_LocalName for element nodes.
It's not used anyway.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-31 19:13:10 +02:00
Jacek Caban 6917e2aa3c xmllite: Clear all parser values in SetInput.
Not clearing namespaces was problematic for tests, but clearing other
values also looks like a good idea.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-30 22:06:30 +02:00
Jacek Caban 291ffdd7ff xmllite: Don't fail in readerinput_detectencoding if input buffer has 3 bytes.
3 bytes are enough for detection code and we already have tests for
that, except they (accidentally, I assume) include null byte in the stream.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-28 22:17:27 +02:00
Jacek Caban 536ed3f3fb xmllite: Return empty value for end element and none nodes.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-22 18:40:30 +01:00
Jacek Caban 48fff1b931 xmllite: Replace crln in input buffer with nl.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-22 18:40:26 +01:00
Jacek Caban 2b5203bdcd xmllite: Fixed ReadValueChunk implementation.
Mostly copy all characters to output buffer, but also minor fixes to
returned values found by tests.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-22 17:05:14 +01:00
Jacek Caban a3d78064d9 xmllite: Fixed buffer handling in reader_parse_reference.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-20 14:03:51 +01:00
Jacek Caban 68aeee4d79 xmllite: Return WC_E_SYNTAX if there is unexpected data in the end of the stream.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-20 14:03:49 +01:00
Nikolay Sivov 253f233e52 xmllite/reader: Return same string for local and qualified names for attributes when appropriate.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-17 15:54:19 +01:00
Nikolay Sivov d7057a34b3 xmllite/reader: For elements without a prefix return same string for both local and qualified names.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-17 15:54:16 +01:00
Nikolay Sivov 1e015f1e14 xmllite/reader: Always return local name from element structure.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-17 15:54:13 +01:00
Nikolay Sivov 876de4a73d xmllite/reader: Reset reader nesting depth on error.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-13 19:28:35 +01:00
Nikolay Sivov ec9e05c27c xmllite/reader: Enter error state on parsing error.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-13 19:28:32 +01:00
Nikolay Sivov b115e9675f xmllite/reader: Improve returned position for whitespace text nodes.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-10 10:03:52 +01:00
Nikolay Sivov 9685fec174 xmllite/reader: Improve line number updating when switching to the next line.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-10 10:03:50 +01:00
Nikolay Sivov 79a65678fc xmllite/reader: Fix position methods return values in closed reader state.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-10 10:03:48 +01:00
Nikolay Sivov 62a41d035c xmllite/reader: Return correct error for multiple colons in qualified name.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-10 10:03:46 +01:00
Nikolay Sivov 3b83a44639 xmllite/reader: Explicitly return empty string as qualified name for some node types.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-10 10:03:44 +01:00
Nikolay Sivov 52f91932ac xmllite/reader: Explicitly return empty static string as local name for nodes without names.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-10 10:03:42 +01:00
Nikolay Sivov 1ccc1f2f26 xmllite/reader: Return static empty string as xml declaration node value.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-10 10:03:40 +01:00
Nikolay Sivov 65e62c3308 xmllite/reader: Fix reader position returned for xml declaration node.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-09 10:18:13 +01:00
Nikolay Sivov 6cf9524f07 xmllite/reader: Improve returned reader position for elements and attributes.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-09 10:18:11 +01:00
Nikolay Sivov e1c31e13a8 xmllite/reader: Remove redundant parameter.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-09 10:18:09 +01:00
Nikolay Sivov d3319f60ad xmllite/reader: Return prefixes from namespace stack.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-09 10:18:06 +01:00
Nikolay Sivov b57589a32d xmllite/reader: Return qualified element names from the stack, instead of input buffer.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-08 15:30:24 +01:00
Nikolay Sivov 3ae1043fc1 xmllite/reader: Return local element names from the stack, instead of input buffer.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-08 15:30:22 +01:00
Nikolay Sivov 3697bd9acf xmllite/reader: Return empty string for namespace uri for some nodes.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-08 15:30:20 +01:00
Nikolay Sivov 63c489fab5 xmllite/reader: Fix GetValue() for comments.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-08 15:30:18 +01:00
Nikolay Sivov 71a0733052 xmllite/reader: Enforce maximum element depth limit.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-07 09:00:51 +01:00
Nikolay Sivov ce84b20554 xmllite/reader: Return qualified names for attributes.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-07 09:00:49 +01:00