sync:Fix crash with malformed document

Signed-off-by: zhangzhangxin <zhangxin1@xfusion.com>
This commit is contained in:
zhangzhangxin 2023-07-10 14:14:33 +08:00
parent bc35e3ac7e
commit 5bb0accb38
2 changed files with 31 additions and 1 deletions

View File

@ -0,0 +1,26 @@
From ad84398cbdf5b66abde8c90b55df386482ece1ff Mon Sep 17 00:00:00 2001
From: zhangzhangxin <zhangxin1@xfusion.com>
Date: Fri, 7 Jul 2023 16:36:16 +0800
Subject: [PATCH] sync:Fix crash with malformed document
Signed-off-by: zhangzhangxin <zhangxin1@xfusion.com>
---
libspectre/ps.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libspectre/ps.c b/libspectre/ps.c
index fb84d80..62472b1 100644
--- a/libspectre/ps.c
+++ b/libspectre/ps.c
@@ -1065,7 +1065,7 @@ continuepage:
iscomment(line+2, "PageMedia:")) {
cp = ps_gettext(line+length("%%PageMedia:"), NULL);
for (dmp = doc->media, i=0; i<doc->nummedia; i++, dmp++) {
- if (strcmp(cp, dmp->name) == 0) {
+ if (cp && strcmp(cp, dmp->name) == 0) {
doc->pages[doc->numpages].media = dmp;
break;
}
--
2.40.0.windows.1

View File

@ -1,6 +1,6 @@
Name: libspectre
Version: 0.2.8
Release: 9
Release: 10
Summary: A small library for rendering Postscript documents
License: GPLv2+
URL: http://libspectre.freedesktop.org
@ -8,6 +8,7 @@ Source0: http://libspectre.freedesktop.org/releases/%{name}-%{version}.ta
BuildRequires: libgs-devel
Patch0: 0001-sync-state-what-lib-is-printing-the-error.patch
Patch1: 0002-sync-Fix-crash-with-malformed-document.patch
%description
Libspectre is a small library for rendering Postscript documents.
@ -50,6 +51,9 @@ developing applications that use libspectre.
%{_libdir}/pkgconfig/libspectre.pc
%changelog
* Mon Jul 10 2023 zhangxin <zhangxin1@xfusion.com> - 0.2.8-10
- Fix crash with malformed document
* Mon Jul 10 2023 zhangxin <zhangxin1@xfusion.com> - 0.2.8-9
- state what lib is printing the error