From 6246011ca2757491fd7d492838e56a52ddb87645 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 26 Feb 2022 20:47:44 +0000 Subject: Fix [424773a00c]: NULL dereference in PostscriptBitmap(). Test canvPs-5.1 now passes. --- generic/tkCanvPs.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c index 1a8b3d3..fc3a772 100644 --- a/generic/tkCanvPs.c +++ b/generic/tkCanvPs.c @@ -904,6 +904,18 @@ PostscriptBitmap( imagePtr = XGetImage(Tk_Display(tkwin), bitmap, 0, 0, totalWidth, totalHeight, 1, XYPixmap); + + if (!imagePtr) { + /* + * The XGetImage() function is apparently not implemented on this + * system. Just skip the pixels, the Postscript will still be + * syntactically correct. + */ + + Tcl_AppendToObj(psObj, "<>", -1); + return; + } + Tcl_AppendToObj(psObj, "<", -1); mask = 0x80; value = 0; -- cgit v0.12