From 5bb0accb3851d0aa2c610257b83cef9a261cdf4b Mon Sep 17 00:00:00 2001 From: zhangzhangxin Date: Mon, 10 Jul 2023 14:14:33 +0800 Subject: [PATCH] sync:Fix crash with malformed document Signed-off-by: zhangzhangxin --- ...nc-Fix-crash-with-malformed-document.patch | 26 +++++++++++++++++++ libspectre.spec | 6 ++++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 0002-sync-Fix-crash-with-malformed-document.patch diff --git a/0002-sync-Fix-crash-with-malformed-document.patch b/0002-sync-Fix-crash-with-malformed-document.patch new file mode 100644 index 0000000..322c17a --- /dev/null +++ b/0002-sync-Fix-crash-with-malformed-document.patch @@ -0,0 +1,26 @@ +From ad84398cbdf5b66abde8c90b55df386482ece1ff Mon Sep 17 00:00:00 2001 +From: zhangzhangxin +Date: Fri, 7 Jul 2023 16:36:16 +0800 +Subject: [PATCH] sync:Fix crash with malformed document + +Signed-off-by: zhangzhangxin +--- + 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; inummedia; 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 + diff --git a/libspectre.spec b/libspectre.spec index e80e895..f73039d 100644 --- a/libspectre.spec +++ b/libspectre.spec @@ -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 - 0.2.8-10 +- Fix crash with malformed document + * Mon Jul 10 2023 zhangxin - 0.2.8-9 - state what lib is printing the error -- Gitee