From cee097664e48c391801fdb1748bbee72392bf01198abb1eb99bdf1b3f00af68e Mon Sep 17 00:00:00 2001 From: Martin Wilck Date: Wed, 6 Jun 2018 13:07:52 +0000 Subject: [PATCH] Accepting request 613815 from home:mwilck:branches:Printing - avoid segfault in DJGenericVIP::DJGenericVIP() (boo#1094141) * added hpijs-avoid-segfault-in-DJGenericVIP-DJGenericVIP.patch OBS-URL: https://build.opensuse.org/request/show/613815 OBS-URL: https://build.opensuse.org/package/show/Printing/hplip?expand=0&rev=153 --- ...egfault-in-DJGenericVIP-DJGenericVIP.patch | 73 +++++++++++++++++++ hplip.changes | 6 ++ hplip.spec | 4 +- 3 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 hpijs-avoid-segfault-in-DJGenericVIP-DJGenericVIP.patch diff --git a/hpijs-avoid-segfault-in-DJGenericVIP-DJGenericVIP.patch b/hpijs-avoid-segfault-in-DJGenericVIP-DJGenericVIP.patch new file mode 100644 index 0000000..ed7b13b --- /dev/null +++ b/hpijs-avoid-segfault-in-DJGenericVIP-DJGenericVIP.patch @@ -0,0 +1,73 @@ +From 894ea64f4742a5c2a5f17f4e950f4ae3599d802e Mon Sep 17 00:00:00 2001 +From: Martin Wilck +Date: Fri, 1 Jun 2018 17:09:31 +0200 +Subject: [PATCH] hpijs: avoid segfault in DJGenericVIP::DJGenericVIP() + +DJGenericVIP::DJGenericVIP() doesn't treat an error from VerifyPenInfo() as +fatal, but the superclass constructor DJ9xxVIP::DJ9xxVIP() does. This +may lead to a sefgault in DJGenericVIP::DJGenericVIP() because ModeCount and +pMode aren't initialized by the superclass constructor. + +Signed-off-by: Martin Wilck +--- + prnt/hpijs/dj9xxvip.cpp | 8 ++++++-- + prnt/hpijs/dj9xxvip.h | 3 ++- + prnt/hpijs/djgenericvip.cpp | 2 +- + 3 files changed, 9 insertions(+), 4 deletions(-) + +diff --git a/prnt/hpijs/dj9xxvip.cpp b/prnt/hpijs/dj9xxvip.cpp +index 519036c..0a5c959 100644 +--- a/prnt/hpijs/dj9xxvip.cpp ++++ b/prnt/hpijs/dj9xxvip.cpp +@@ -55,7 +55,8 @@ extern MediaType MediaTypeToPcl (MEDIATYPE eMediaType); + DJ9xxVIP::DJ9xxVIP + ( + SystemServices* pSS, +- BOOL proto ++ BOOL proto, ++ BOOL ignore_pen_error + ) : + Printer(pSS, NUM_DJ6XX_FONTS, proto), + PCL3acceptsDriverware(TRUE) +@@ -67,7 +68,10 @@ DJ9xxVIP::DJ9xxVIP + { + bCheckForCancelButton = TRUE; + constructor_error = VerifyPenInfo(); +- CERRCHECK; ++ if (!ignore_pen_error) { ++ CERRCHECK; ++ } else ++ ePen = BOTH_PENS; + } + else ePen = BOTH_PENS; // matches default mode + +diff --git a/prnt/hpijs/dj9xxvip.h b/prnt/hpijs/dj9xxvip.h +index 85eb3ac..8d42265 100644 +--- a/prnt/hpijs/dj9xxvip.h ++++ b/prnt/hpijs/dj9xxvip.h +@@ -42,7 +42,8 @@ APDK_BEGIN_NAMESPACE + class DJ9xxVIP : public Printer + { + public: +- DJ9xxVIP(SystemServices* pSS, BOOL proto=FALSE); ++ DJ9xxVIP(SystemServices* pSS, BOOL proto=FALSE, ++ BOOL ignore_pen_error=TRUE); + + Header* SelectHeader(PrintContext* pc); + DRIVER_ERROR VerifyPenInfo(); +diff --git a/prnt/hpijs/djgenericvip.cpp b/prnt/hpijs/djgenericvip.cpp +index b7e79dc..7228fcf 100644 +--- a/prnt/hpijs/djgenericvip.cpp ++++ b/prnt/hpijs/djgenericvip.cpp +@@ -47,7 +47,7 @@ extern uint32_t ulMapDJ600_CCM_K[ 9 * 9 * 9 ]; + */ + + DJGenericVIP::DJGenericVIP (SystemServices* pSS, BOOL proto) +- : DJ9xxVIP (pSS, proto) ++ : DJ9xxVIP (pSS, proto, true) + { + + if (!proto && IOMode.bDevID) +-- +2.17.0 + diff --git a/hplip.changes b/hplip.changes index 2a62c7e..7b21f98 100644 --- a/hplip.changes +++ b/hplip.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Jun 1 15:18:19 UTC 2018 - mwilck@suse.com + +- avoid segfault in DJGenericVIP::DJGenericVIP() (boo#1094141) + * added hpijs-avoid-segfault-in-DJGenericVIP-DJGenericVIP.patch + ------------------------------------------------------------------- Thu Mar 22 08:44:17 UTC 2018 - mwilck@suse.com diff --git a/hplip.spec b/hplip.spec index 98e8a62..dea0a07 100644 --- a/hplip.spec +++ b/hplip.spec @@ -57,7 +57,7 @@ Name: hplip Version: 3.17.9 Release: 0 Summary: HP's Printing, Scanning, and Faxing Software -License: BSD-3-Clause and GPL-2.0+ and MIT +License: BSD-3-Clause AND GPL-2.0-or-later AND MIT Group: Hardware/Printing Url: http://hplipopensource.com # Source0...Source9 is for sources from HP: @@ -89,6 +89,7 @@ Patch107: hplip-udev-rules-in-usr.patch Patch108: add_missing_includes_and_define_GNU_SOURCE.patch # PATCH-FIX-SUSE: GNOME no longer provides a system tray, so don't warn the user that we can't find it Patch109: no-systray-failure-message.patch +Patch110: hpijs-avoid-segfault-in-DJGenericVIP-DJGenericVIP.patch # Patch200 fixes device communication and detection via MDNS in some network setups: Patch200: hplip-mdns.patch # Patch201 makes MDNS lookups more robust by retrying queries: @@ -396,6 +397,7 @@ This sub-package is only required by developers. # and missing '#define _GNU_SOURCE' see https://bugs.launchpad.net/hplip/+bug/1456590 %patch108 -p1 -b .add_missing_includes_and_define_GNU_SOURCE.orig %patch109 -p1 -b .systemtray.py.orig +%patch110 -p1 -b .boo1094141 %patch200 -p1 -b .mdns %patch201 -p1 -b .mdns-retry %patch300 -p1 -b .pcardext-python3