unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob a74120c153e1dee60d307712722a6e4a0f9af475 1429 bytes (raw)
name: gnu/packages/patches/libwmf-CVE-2016-9011.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
 
Fix CVE-2016-9011:

https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-9011
https://blogs.gentoo.org/ago/2016/10/18/libwmf-memory-allocation-failure-in-wmf_malloc-api-c/

Patch copied from Fedora:

https://src.fedoraproject.org/cgit/rpms/libwmf.git/commit/?id=9a43f910abce9940f07843e7186646ad46b686d6

--- libwmf-0.2.8.4/src/player.c
+++ libwmf-0.2.8.4/src/player.c
@@ -139,8 +139,31 @@
 		WMF_DEBUG (API,"bailing...");
 		return (API->err);
 	}
-	
- 	P->Parameters = (unsigned char*) wmf_malloc (API,(MAX_REC_SIZE(API)  ) * 2 * sizeof (unsigned char));
+
+	U32 nMaxRecordSize = (MAX_REC_SIZE(API)  ) * 2 * sizeof (unsigned char);
+	if (nMaxRecordSize)
+	{
+		//before allocating memory do a sanity check on size by seeking
+		//to claimed end to see if its possible. We're constrained here
+		//by the api and existing implementations to not simply seeking
+		//to SEEK_END. So use what we have to skip to the last byte and
+		//try and read it.
+		const long nPos = WMF_TELL (API);
+		WMF_SEEK (API, nPos + nMaxRecordSize - 1);
+		if (ERR (API))
+		{	WMF_DEBUG (API,"bailing...");
+			return (API->err);
+		}
+		int byte = WMF_READ (API);
+		if (byte == (-1))
+		{	WMF_ERROR (API,"Unexpected EOF!");
+		       	API->err = wmf_E_EOF;
+		       	return (API->err);
+		}
+		WMF_SEEK (API, nPos);
+	}
+
+ 	P->Parameters = (unsigned char*) wmf_malloc (API, nMaxRecordSize);
 
 	if (ERR (API))
 	{	WMF_DEBUG (API,"bailing...");

debug log:

solving a74120c15 ...
found a74120c15 in https://yhetil.org/guix-devel/20170527170600.GA16269@jasmine/

applying [1/1] https://yhetil.org/guix-devel/20170527170600.GA16269@jasmine/
diff --git a/gnu/packages/patches/libwmf-CVE-2016-9011.patch b/gnu/packages/patches/libwmf-CVE-2016-9011.patch
new file mode 100644
index 000000000..a74120c15

1:19: space before tab in indent.
 		WMF_DEBUG (API,"bailing...");
1:20: space before tab in indent.
 		return (API->err);
1:21: space before tab in indent.
 	}
1:22: trailing whitespace.
-	
1:49: trailing whitespace.
 
Checking patch gnu/packages/patches/libwmf-CVE-2016-9011.patch...
Applied patch gnu/packages/patches/libwmf-CVE-2016-9011.patch cleanly.
warning: squelched 2 whitespace errors
warning: 7 lines add whitespace errors.

index at:
100644 a74120c153e1dee60d307712722a6e4a0f9af475	gnu/packages/patches/libwmf-CVE-2016-9011.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).