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

1263 Commits

Author SHA1 Message Date
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 11.0.0 2025-03-15 14:45:48 -07:00
Lee Thomason 57eea48c5b version to 10.1.0 10.1.0 2025-03-08 10:45:16 -08:00
Lee Thomason 198cb82c9b Merge pull request #1017 from luzpaz/typos-xmltest
fix typos in xmltest.cpp
2025-03-08 10:36:50 -08:00
Lee Thomason c6ab6d76e8 Merge pull request #1013 from AlbertHungGarmin/arm_compiler_error
Fix ARM Compiler build errors
2025-03-08 10:36:09 -08:00
luzpaz 008e32968f fix typos in xmltest.cpp
Found via `codespell -q 3 -S "./resources/dream.xml" -L currenty,ot,previousy,te,ue`
2025-01-25 09:51:29 -05:00
Albert Hung 0ca3584fa4 Fix ARM Compiler build errors
Fix build errors on ARM Compiler 5 (DS-5) by treating the compiler like QNX, Borland C, and the Android NDK for purposes of system header includes.
2024-12-17 10:13:57 +08:00
Lee Thomason 57ec94127b Merge pull request #1011 from leethomason/leethomason/charref2
Defensive check for UTF conversion
2024-12-09 21:47:05 -08:00
Lee Thomason 1fadaae0c9 another defensive check 2024-12-09 21:39:30 -08:00
Lee Thomason 4cbb25155c Merge pull request #1009 from leethomason/leethomason/charref
Fix the potential overflow in char refs
2024-12-09 21:21:42 -08:00
Lee Thomason ff48ea1bae improve fix 2024-12-09 21:17:33 -08:00
Lee Thomason 494735de30 fix the potential overflow in char refs 2024-12-04 18:07:15 -08:00
Lee Thomason d418ac22f2 Merge pull request #1007 from gruenich/feature/update-github-actions
update GitHub actions checkout and actions-setup-cmake
2024-12-04 17:49:04 -08:00
Lee Thomason d13a151c8d Merge pull request #1004 from bebuch/master
add CMake option to disable PkgConfig install
2024-12-04 17:46:06 -08:00
Lee Thomason 601a953b74 Merge pull request #1008 from AlbertHungGarmin/old-style-cast_warning
Fixed old-style-cast warnings
2024-12-04 17:44:31 -08:00
Albert Hung 162bd4e925 Fixed -Wold-style-cast warnings
Fixed old-style-cast warnings
2024-12-02 13:47:07 +08:00
Christoph Grüninger 1fdf653269 GitHub Actions: Update actions/checkout to v4
Fixes warnings regarding deprecated node12
2024-11-24 17:24:03 +01:00
Christoph Grüninger 86fe31c836 GitHub Actions: Update actions-setup-cmake to v2
Fixes warnings regarding deprecated node12
2024-11-24 17:21:49 +01:00
Benjamin Buch 20ecbb22d8 add CMake option to disable PkgConfig install 2024-11-20 16:22:20 +01: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
Lee Thomason 38894bfa7f Merge pull request #993 from jengelh/master
Make DocPrinter support DynArrays larger than 2G
2024-09-02 09:29:54 -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
Lee Thomason 8a519a556a Merge pull request #990 from jengelh/master
Avoid crashing when SetText is called with a 2GB large string
2024-07-06 12:41:55 -07:00
Lee Thomason c93b6f78d4 Revert "Merge pull request #983 from DiplomInformatikerFranzHoepfinger/feature/fix_32_bit_types"
This reverts commit 8e4bfebad5, reversing
changes made to a0f66fdf71.
2024-07-06 12:28:04 -07:00
Lee Thomason 8e4bfebad5 Merge pull request #983 from DiplomInformatikerFranzHoepfinger/feature/fix_32_bit_types
Update QueryIntValue and QueryUnsignedValue to use int32_t and uint32_t types for better consistency.
2024-07-06 12:00:24 -07: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 a0f66fdf71 Merge pull request #984 from Blake-Madden/master
Fix typo in comment
2024-06-13 08:29:51 -07:00
Lee Thomason a965e28c4f Merge pull request #978 from AlbertHungGarmin/fix-format-specifier
Fix format specifier mismatch in XMLUtil::ToStr
2024-06-13 08:17:16 -07:00
Blake-Madden 5b04868fee Fix typo in comment 2024-06-01 15:41:57 -04:00
Franz Höpfinger 8df9b25bb9 Update attribute handling to use int32_t and uint32_t types.
The commit changes the attribute handling in the code to utilize int32_t and uint32_t types for better consistency and compatibility.
2024-05-30 20:31:00 +02:00
Franz Höpfinger 53d8ec5573 Update attribute setting functions to use specific integer types
The commit updates attribute setting functions to use int32_t and uint32_t types for better clarity and consistency.
2024-05-30 20:28:46 +02:00
Franz Höpfinger 5e27269c04 Update attribute setting functions to use specific integer types
The commit changes the attribute setting functions in both the .cpp and .h files to use int32_t and uint32_t instead of int and unsigned for better type specificity.
2024-05-30 20:27:26 +02:00
Franz Höpfinger 693052afe4 Update integer types to int32_t and uint32_t for better clarity and consistency. 2024-05-30 20:19:13 +02:00
Franz Höpfinger 42875a9f60 Update data type in ToBool function for better clarity and consistency.
- Change int to int32_t in the ToBool function for improved data type clarity.
2024-05-30 20:16:20 +02:00
Franz Höpfinger afb8fabf58 Update integer parsing to use long type and unsigned parsing to use unsigned long type for better compatibility with different platforms.
Update integer parsing to use long type and unsigned parsing to use unsigned long type for better compatibility with different platforms. Alternatively, use the PRI Macros there.

alternatively use the PRI Macros there.
2024-05-30 20:13:48 +02:00
Franz Höpfinger a151353f3a Update integer to string conversion functions for different data types.
- Changed formatting from %d to %ld for int32_t.
- Changed formatting from %u to %lu for uint32_t.

alternatively use the PRI Macros there.
2024-05-30 20:08:50 +02:00
Franz Höpfinger ef185a8f85 Update PushText functions to use specific integer types
The commit changes the PushText functions in both the .cpp and .h files to utilize int32_t and uint32_t instead of int and unsigned for better type specificity.
2024-05-30 20:05:52 +02:00
Franz Höpfinger 8fed517e5d Update SetText method parameters to use int32_t and uint32_t.
This change updates the SetText method in both the .cpp and .h files to use int32_t and uint32_t types for better consistency and clarity.
2024-05-30 19:53:50 +02:00
Franz Höpfinger e269b2e91f Update QueryIntText and QueryUnsignedText functions to use int32_t and uint32_t types instead of int and unsigned in tinyxml2.cpp and tinyxml2.h. 2024-05-30 19:53:44 +02:00
Franz Höpfinger cd8c1a6322 Update ToStr functions to use int32_t and uint32_t types, and change corresponding function signatures in the header file. Update ToInt and ToUnsigned functions to use int32_t and uint32_t types respectively. 2024-05-30 19:34:59 +02:00
Franz Höpfinger 668fd81256 Update attribute types to int32_t and uint32_t for better consistency and clarity.
Update attribute types to int32_t and uint32_t for better consistency and clarity.

Changed attribute types to int32_t and uint32_t for IntAttribute and UnsignedAttribute methods in both .cpp and .h files.
2024-05-30 19:31:58 +02:00
Franz Höpfinger 095a8ffa42 Update IntValue and UnsignedValue to use int32_t and uint32_t types.
This change ensures consistent integer handling throughout the codebase.
2024-05-30 19:24:09 +02:00
Franz Höpfinger 574c760b7f Update attribute query functions to use int32_t and uint32_t types.
- Changed QueryAttribute parameter type from int* to int32_t*
- Changed QueryAttribute parameter type from unsigned int* to uint32_t*
2024-05-30 19:22:25 +02:00
Franz Höpfinger 5d219c893b Update attribute query functions to use int32_t and uint32_t types.
- Changed QueryIntAttribute parameter type from int* to int32_t*
- Changed QueryUnsignedAttribute parameter type from unsigned int* to uint32_t*
2024-05-30 19:21:27 +02:00
Franz Höpfinger fd26a5ee1f Update QueryIntValue and QueryUnsignedValue to use int32_t and uint32_t types for better consistency. 2024-05-30 19:15:52 +02:00