Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
tinyxml2 (9.0.0+dfsg-3deepin1) unstable; urgency=medium

* Fix potential overflow in char refs (CVE-2024-50614, CVE-2024-50615)
- Patch from upstream commit 494735de30c9
- Fixes reachable assertion in XMLUtil::GetCharacterRef

-- deepin-ci-robot <packages@deepin.org> Tue, 26 May 2026 23:30:00 +0800

tinyxml2 (9.0.0+dfsg-3) unstable; urgency=medium

* [a6e98f0] Drop Provides/Conflicts libtinyxml2-8 (Closes: #992602)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
--- a/tinyxml2.cpp
+++ b/tinyxml2.cpp
@@ -471,12 +471,13 @@
{
// Presume an entity, and pull it out.
*length = 0;
+ static const uint32_t MAX_CODE_POINT = 0x10FFFF;

if ( *(p+1) == '#' && *(p+2) ) {
- unsigned long ucs = 0;
+ uint32_t ucs = 0;
TIXMLASSERT( sizeof( ucs ) >= 4 );
ptrdiff_t delta = 0;
- unsigned mult = 1;
+ uint32_t mult = 1;
static const char SEMICOLON = ';';

if ( *(p+2) == 'x' ) {
@@ -497,7 +498,7 @@
--q;

while ( *q != 'x' ) {
- unsigned int digit = 0;
+ uint32_t digit = 0;

if ( *q >= '0' && *q <= '9' ) {
digit = *q - '0';
@@ -512,11 +513,11 @@
return 0;
}
TIXMLASSERT( digit < 16 );
- TIXMLASSERT( digit == 0 || mult <= UINT_MAX / digit );
- const unsigned int digitScaled = mult * digit;
- TIXMLASSERT( ucs <= ULONG_MAX - digitScaled );
+ const uint32_t digitScaled = mult * digit;
ucs += digitScaled;
- TIXMLASSERT( mult <= UINT_MAX / 16 );
+ if (ucs > MAX_CODE_POINT) {
+ return 0;
+ }
mult *= 16;
--q;
}
@@ -540,22 +541,23 @@

while ( *q != '#' ) {
if ( *q >= '0' && *q <= '9' ) {
- const unsigned int digit = *q - '0';
+ const uint32_t digit = *q - '0';
TIXMLASSERT( digit < 10 );
- TIXMLASSERT( digit == 0 || mult <= UINT_MAX / digit );
- const unsigned int digitScaled = mult * digit;
- TIXMLASSERT( ucs <= ULONG_MAX - digitScaled );
+ const uint32_t digitScaled = mult * digit;
ucs += digitScaled;
+ if (ucs > MAX_CODE_POINT) {
+ return 0;
+ }
}
else {
return 0;
}
- TIXMLASSERT( mult <= UINT_MAX / 10 );
mult *= 10;
--q;
}
}
// convert the UCS to UTF-8
+ TIXMLASSERT(ucs <= MAX_CODE_POINT);
ConvertUTF32ToUTF8( ucs, value, length );
return p + delta + 1;
}
1 change: 1 addition & 0 deletions debian/patches/series
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Set-visibility-to-hidden-for-private-functions.patch
Fix-potential-overflow-in-char-refs-CVE-2024-50614-50615.patch
Loading