summaryrefslogtreecommitdiff
path: root/gnome-unstable/tracker/tracker-extract-pdf-crash-fix.patch
blob: ac8522f6a1e044bf9cd9d8998ad8d761ac805af1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
From 008677280d32b6db56483832b143760888c91ad4 Mon Sep 17 00:00:00 2001
From: Sam Thursfield <sam.thursfield@codethink.co.uk>
Date: Tue, 31 Jul 2012 14:26:53 +0000
Subject: tracker-extract-pdf: Fix crash if mmap() fails

Patch from Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=751922
---
diff --git a/src/tracker-extract/tracker-extract-pdf.c b/src/tracker-extract/tracker-extract-pdf.c
index caa24c7..85066b3 100644
--- a/src/tracker-extract/tracker-extract-pdf.c
+++ b/src/tracker-extract/tracker-extract-pdf.c
@@ -451,7 +451,7 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
 		len = 0;
 	} else {
 		contents = (gchar *) mmap (NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
-		if (contents == NULL) {
+		if (contents == NULL || contents == MAP_FAILED) {
 			g_warning ("Could not mmap pdf file '%s': %s\n",
 			           filename,
 			           g_strerror (errno));
--
cgit v0.9.0.2