1
0
mirror of https://github.com/leethomason/tinyxml2.git synced 2026-07-21 19:23:00 +04:00
Commit Graph

396 Commits

Author SHA1 Message Date
Lee Thomason 111f462dc4 remove old comments 2026-03-09 17:41:19 -07:00
Lee Thomason 30dee1efa0 Merge pull request #1021 from Malcohol/Malcohol/optionalAposHandling
Optional Apos escaping
2025-06-08 11:17:12 -07:00
Malcolm Tyrrell 487f42aa69 Optional apos escaping 2025-03-29 18:13:43 +00:00
Levente Batuska afff7bf328 fix: remove unnecessary assert 2025-03-20 02:06:08 +01:00
Lee Thomason 9148bdf719 setting the version to 11.0.0 2025-03-15 14:45:48 -07:00
Lee Thomason 57eea48c5b version to 10.1.0 2025-03-08 10:45:16 -08:00
Lee Thomason 374292e9ba Merge pull request #998 from Sigmarik/master
Fix: typo in the `XMLNode::DeepClone` description
2024-09-02 09:33:10 -07:00
Lee Thomason 2ac336a253 Merge pull request #992 from ssmolov/namespace.comment.fix
fix tinyxml2 namespaces' ending comment
2024-09-02 09:32:55 -07:00
sigmarik 780b16b5ae chore: fix typo in the XMLNode::DeepClone description 2024-08-31 19:34:27 +03:00
Jan Engelhardt 04bbc06cd0 Make DocPrinter support DynArrays larger than 2G
If the DynArray within an XMLPrinter object carries 2 gigabytes of
data or more, XMLPrinter::CStrSize returns a truncated result. If a
program casts this back to size_t without thought, sign extension
leads to bad things(tm).

```c++
int main()
{
	tinyxml2::XMLDocument doc;
	doc.InsertEndChild(doc.NewDeclaration());
	auto root = doc.NewElement("root");
	size_t sz = 0x80000002;
	auto blank = new char[sz];
	memset(blank, ' ', sz);
	blank[sz-1]='\0';
	root->SetText(blank);
	doc.InsertEndChild(root);
	tinyxml2::XMLPrinter printer(nullptr);
	doc.Print(&printer);
	std::string_view sv{printer.CStr(), static_cast<size_t>(printer.CStrSize())};
	// sv.size() is way too big, causing overflows on access
	std::string dup(sv); // boom
}
```

Fixes: 2.0.2-873-geb3ab0d
2024-08-14 15:28:42 +02:00
Sergey Smolov 62f6b14e91 fixup
Signed-off-by: Sergey Smolov <smolov@ispras.ru>
2024-08-12 19:22:22 +03:00
Sergey Smolov b25c39aaad fix tinyxml2 namespaces' ending comment
Signed-off-by: Sergey Smolov <smolov@ispras.ru>
2024-08-12 19:16:14 +03:00
Jan Engelhardt eb3ab0df5d Make DynArray support objects larger than 1 gigabyte
The expression ``const int newAllocated = cap * 2;`` easily causes
overflow, as soon as the input is 1.0 GiB. This goes unnoticed because
release builds of tinyxml2 do not have active assertions.

The change in commit 9.0.0-20-g8fd6cc6 did not do anything useful;
the signed multiplication overflow (and thus undefined behavior)
still occurs.

Using ``int`` in this class is really archaic, because it limits the
class to a gigabyte even on 64-bit platforms.

The multiplication overflow check also needs to include sizeof(T),
otherwise you can run into unsigned multiplication overflow (defined,
but undesirable) in the memcpy() call.

testcase:

int main()
{
        tinyxml2::XMLDocument doc;
        doc.InsertEndChild(doc.NewDeclaration());
        auto root = doc.NewElement("root");
        size_t sz = 0x80000001;
        auto blank = new char[sz];
        memset(blank, ' ', sz);
        blank[sz-1]='\0';
        root->SetText(blank);
        doc.InsertEndChild(root);
        tinyxml2::XMLPrinter printer(nullptr);
        doc.Print(&printer);
}
2024-07-01 22:07:51 +02:00
Jan Engelhardt 3a893e5757 Remove extraneous +x bit from source files 2024-07-01 14:14:33 +02:00
Lee Thomason 35099af4f3 updating version 2023-12-30 17:56:34 -08:00
Lee Thomason 9d026527a4 Merge branch 'pedantic-whitespace' of https://github.com/kcsaul/tinyxml2 into kcsaul-pedantic-whitespace 2023-11-21 11:40:52 -08:00
Lee Thomason 4c27b08f62 Merge pull request #949 from imba-tjd/master-1
fix compiler detection
2023-11-20 21:27:14 -08:00
Lee Thomason ac23537e06 Merge pull request #933 from kb1sph/master
Added ChildElementCount()
2023-11-20 21:22:19 -08:00
Lee Thomason 52035717a3 Merge pull request #911 from JurajX/fix_warnings
Fix warnings
2023-11-20 21:11:09 -08:00
谭九鼎 cc4c1df7ec fix compiler detection 2023-08-09 18:28:44 +08:00
Kevin Saul 98303bbda3 add pedantic whitespace mode 2023-05-28 21:36:28 +12:00
kb1sph 904ad04bea Added ChildElementCount
Added ChildElementCount suggested by msteiger on sourceforge for original tinyxml.  Modified for TinyXML-2.
2023-02-06 19:07:13 -05:00
Lee Thomason e05956094c Merge pull request #925 from hordi/patch-1
Update tinyxml2.h
2023-01-14 18:02:53 -08:00
Yurii Hordiienko 2555efa919 Update tinyxml2.h
do we really need that implicit memset call in line 378?
2022-11-15 17:49:45 -05:00
Juraj 8fd6cc6d2d fix gcc sizetype complaint 2022-06-07 08:07:33 +02:00
Juraj beb2b2f82d fix more -Wsign-conversion warnings 2022-06-07 07:53:54 +02:00
Juraj 07f497d6d8 fix -Wsuggest-override warnings 2022-06-07 07:27:41 +02:00
Juraj 0691cf72b4 fix -Wsign-conversion warnings 2022-06-07 07:27:27 +02:00
Alessio Quaglino 736659015c Update tinyxml2.h
Increase maximum recursion depth
2022-06-06 14:08:40 +02:00
firewave c27699a9d6 fixed Clang -Wextra-stmt warnings with TIXMLASSERT 2021-10-30 13:57:50 +02:00
Lee Thomason 1dee28e51f setting the version to 9.0.0 2021-06-06 17:10:24 -07:00
Lee Thomason 9c6752a641 setting the version to 8.1.0 2021-05-15 20:21:47 -07:00
Lee Thomason 91bfd4b7fc Merge pull request #827 from ngc92/ClearError
removed overhead of clear error
2020-12-30 10:35:45 -08:00
Pantelis Lekakis c87bf8187d reverted the strong typed enum change 2020-09-23 21:59:13 +01:00
Pantelis Lekakis 6df0cae189 - Allowing TIXMLASERT to be defined before including the main header.
- Fix for enum bitmask usage
2020-09-08 00:41:58 +01:00
ngc92 2c6a41a92e removed overhead of clear error 2020-07-30 23:51:30 +03:00
Lee Thomason 4637965335 add test case 2020-07-02 15:23:00 -07:00
justnope 5ee20feaf0 Add QueryAttribute for const char** 2020-06-15 00:47:48 +02:00
Lee Thomason 098eb37398 Merge branch 'master' of github.com:leethomason/tinyxml2 2020-06-13 17:46:53 -07:00
Lee Thomason 8812f197ac make printer functions virtual 2020-06-13 17:46:44 -07:00
Lee Thomason 1578df3bf8 Merge pull request #811 from hyperair/fix-first-line-indentation
XMLPrinter: Fix first line indentation
2020-06-13 17:38:20 -07:00
Lee Thomason 18468b8cc4 minor changes to hex parsing 2020-06-13 17:35:21 -07:00
Lee Thomason c9c9d8cdfa Merge branch 'master' of https://github.com/netcan/tinyxml2 into netcan-master 2020-06-13 17:26:30 -07:00
Chow Loong Jin 6a514399c2 XMLPrinter: Fix first line indentation
Fix indentation of first line when called with !compactMode.
2020-03-26 17:04:41 +08:00
netcan dfb45cb73b support IntText(),UnsignedText(),Int64Text() for hex value 2020-03-02 22:26:03 +08:00
Lee Thomason bf15233ad8 Setting the version to 8.0.0 2020-03-01 17:40:07 -08:00
Lee Thomason e444268103 add convenience methods 2020-03-01 17:10:38 -08:00
Lee Thomason 6ac05b2b9a Merge branch 'push' of https://github.com/ngc92/tinyxml2 into ngc92-push 2020-03-01 17:01:33 -08:00
ngc92 e620245043 PushNewChild* family of convenience functions 2019-12-03 16:25:53 +01:00
orbitcowboy 73f5409b62 Improved const correctness. There are no functional changes intended. 2019-08-14 09:30:30 +02:00