aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@redhat.com>2013-05-08 13:45:48 +0800
committerDaniel Veillard <veillard@redhat.com>2013-05-08 13:45:48 +0800
commita75a009d12f64f1bbd4942964d8529f8c44afe5c (patch)
tree158834602dbed24c802c91de88e0b85351e5bbb5
parent0b86537dfa3b0039136ced49c6aab8e50234923f (diff)
downloadandroid_external_libxml2-a75a009d12f64f1bbd4942964d8529f8c44afe5c.tar.gz
android_external_libxml2-a75a009d12f64f1bbd4942964d8529f8c44afe5c.tar.bz2
android_external_libxml2-a75a009d12f64f1bbd4942964d8529f8c44afe5c.zip
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.
-rw-r--r--xmllint.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/xmllint.c b/xmllint.c
index 26d8db1c..c0196abb 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,