summaryrefslogtreecommitdiff
path: root/devices/gdevwpr2.c
diff options
context:
space:
mode:
authorRay Johnston <ray.johnston@artifex.com>2019-11-11 20:14:36 -0800
committerRay Johnston <ray.johnston@artifex.com>2019-11-13 08:19:05 -0800
commitf63270230f329c6e89375af18d2bf2930421174a (patch)
tree97275cb35c3aa08663f0aff3c74fa2ae41c4a7f3 /devices/gdevwpr2.c
parent97277fcf0f70d482481ac329ce473e5687e7a935 (diff)
downloadghostpdl-f63270230f329c6e89375af18d2bf2930421174a.tar.gz
Fix devices that ignore return codes from gdev_prn get_bits & copy_scan_lines
Discovered these when working on bug 701845 'devicen' device. Checking uncovered a plethora of other places that used one of these functions assuming success. Also the gdev_prn_copy_scan_lines had places that assumed the return code was a valid line_count, so if negative, could memset many lines in front of an allocated buffer. The code in a few of these usages is strange, and we don't have a way to check them, so this may not match the original intent. Also, while perusing all of these files, check devices for alloc's that assume success and fix them (usually return gs_error_VMerror).
Diffstat (limited to 'devices/gdevwpr2.c')
-rw-r--r--devices/gdevwpr2.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/devices/gdevwpr2.c b/devices/gdevwpr2.c
index 3f834b577..29af469be 100644
--- a/devices/gdevwpr2.c
+++ b/devices/gdevwpr2.c
@@ -571,9 +571,12 @@ win_pr2_print_page(gx_device_printer * pdev, gp_file * file)
lines = scan_lines - y;
else
lines = yslice;
- for (i = 0; i < lines; i++)
- gdev_prn_copy_scan_lines(pdev, y + i,
+ for (i = 0; i < lines; i++) {
+ code = gdev_prn_copy_scan_lines(pdev, y + i,
row + (bmp_raster * (lines - 1 - i)), raster);
+ if (code < 0)
+ goto xit;
+ }
if (ratio > 1) {
StretchDIBits(wdev->hdcprn, 0, y*ratio, pdev->width*ratio, lines*ratio,
@@ -618,6 +621,7 @@ win_pr2_print_page(gx_device_printer * pdev, gp_file * file)
ShowWindow(wdev->hDlgModeless, SW_HIDE);
}
+xit:
GlobalUnlock(hrow);
GlobalFree(hrow);