1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-20 12:59:25 +00:00
nixpkgs/pkgs/development/libraries/libspectre/0001-Fix-a-crash-with-documents-containing-an-invalid-Pag.patch
2012-08-26 22:06:45 +04:00

30 lines
949 B
Diff

From 7500e4d1ae85ecf9f61b1446e07ebb887118757c Mon Sep 17 00:00:00 2001
From: Carlos Garcia Campos <carlosgc@gnome.org>
Date: Sat, 30 Oct 2010 15:55:18 +0200
Subject: [PATCH 1/2] Fix a crash with documents containing an invalid
%%Pages: comment
When failed to allocate memory for pages because of invalid %%Pages:
comment, set maxpages to 0 to ignore the comment. Problem spotted
by Marek Kasik. Fixes bug #30867.
---
libspectre/ps.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libspectre/ps.c b/libspectre/ps.c
index 6c7cfce..4578cec 100644
--- a/libspectre/ps.c
+++ b/libspectre/ps.c
@@ -597,6 +597,8 @@ psscan(const char *filename, int scanstyle)
if (maxpages > 0) {
doc->pages = (struct page *) PS_calloc(maxpages,
sizeof(struct page));
+ if (!doc->pages)
+ maxpages = 0;
CHECK_MALLOCED(doc->pages);
}
}
--
1.7.11