summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--devices/gdevtfnx.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/devices/gdevtfnx.c b/devices/gdevtfnx.c
index f07cc153c..578e96484 100644
--- a/devices/gdevtfnx.c
+++ b/devices/gdevtfnx.c
@@ -146,12 +146,16 @@ tiff12_print_page(gx_device_printer * pdev, gp_file * file)
146 { 146 {
147 int y; 147 int y;
148 int size = gdev_prn_raster(pdev); 148 int size = gdev_prn_raster(pdev);
149 byte *data = gs_alloc_bytes(pdev->memory, size, "tiff12_print_page"); 149
150 /* We allocate an extra 5 bytes to avoid buffer overflow when accessing
151 src[5] below, if size if not multiple of 6. This fixes bug-701807. */
152 int size_alloc = size + 5;
153 byte *data = gs_alloc_bytes(pdev->memory, size_alloc, "tiff12_print_page");
150 154
151 if (data == 0) 155 if (data == 0)
152 return_error(gs_error_VMerror); 156 return_error(gs_error_VMerror);
153 157
154 memset(data, 0, size); 158 memset(data, 0, size_alloc);
155 159
156 for (y = 0; y < pdev->height; ++y) { 160 for (y = 0; y < pdev->height; ++y) {
157 const byte *src; 161 const byte *src;