summaryrefslogtreecommitdiff
path: root/debian/patches/0005-xmllint-memory-should-fail-on-empty-files.patch
blob: e1a2197bf3b046870557a3c7a5e02afc1357a72b (plain)
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
From: Daniel Veillard <veillard@redhat.com>
Date: Wed, 8 May 2013 05:45:48 +0000
Subject: xmllint --memory should fail on empty files

Exposed by https://bugzilla.gnome.org/show_bug.cgi?id=699896
when doing analysis but a priori unrelated.
---
 xmllint.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/xmllint.c b/xmllint.c
index 26d8db1..c0196ab 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -2338,8 +2338,11 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
 	    if ((fd = open(filename, O_RDONLY)) < 0)
 		return;
 	    base = mmap(NULL, info.st_size, PROT_READ, MAP_SHARED, fd, 0) ;
-	    if (base == (void *) MAP_FAILED)
+	    if (base == (void *) MAP_FAILED) {
+	        fprintf(stderr, "mmap failure for file %s\n", filename);
+		progresult = XMLLINT_ERR_RDFILE;
 	        return;
+	    }
 
 	    if (rectxt == NULL)
 		doc = xmlReadMemory((char *) base, info.st_size,