diff options
author | Marcos H. Woehrmann <marcos.woehrmann@artifex.com> | 2012-03-06 09:06:55 -0800 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2012-03-15 11:54:24 +0000 |
commit | c62b051c09b93b80f338c0750d20211f1c5a00b6 (patch) | |
tree | 1498e5d7ec72dde07ab7e2e3a3db3b3838984b97 | |
parent | 6e4277cbb452b62cb48d7e518061716c30b75191 (diff) |
Fix the checks in gdevtsep.c missed by commit e954dd4683c35dbd66de3e045d979ebbf20c4d72
Henry pointed out that my e954dd4683c35dbd66de3e045d979ebbf20c4d72
fix was incomplete; this commit replaces the remaining max_long
references with 2^32-1.
-rw-r--r-- | gs/base/gdevtsep.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/gs/base/gdevtsep.c b/gs/base/gdevtsep.c index 6ed741c55..b10d8e051 100644 --- a/gs/base/gdevtsep.c +++ b/gs/base/gdevtsep.c @@ -190,8 +190,8 @@ tiffgray_print_page(gx_device_printer * pdev, FILE * file) gx_device_tiff *const tfdev = (gx_device_tiff *)pdev; int code; - if (pdev->height > (max_long - ftell(file))/(pdev->width)) /* note width is never 0 in print_page */ - return_error(gs_error_rangecheck); /* this will overflow max_long */ + if (pdev->height > ((long) 0xFFFFFFFF - ftell(file))/(pdev->width)) /* note width is never 0 in print_page */ + return_error(gs_error_rangecheck); /* this will overflow 32 bits */ code = gdev_tiff_begin_page(tfdev, file); if (code < 0) @@ -355,8 +355,8 @@ tiffcmyk_print_page(gx_device_printer * pdev, FILE * file) gx_device_tiff *const tfdev = (gx_device_tiff *)pdev; int code; - if (pdev->height > (max_long - ftell(file))/(pdev->width)) /* note width is never 0 in print_page */ - return_error(gs_error_rangecheck); /* this will overflow max_long */ + if (pdev->height > ((long) 0xFFFFFFFF - ftell(file))/(pdev->width)) /* note width is never 0 in print_page */ + return_error(gs_error_rangecheck); /* this will overflow 32 bits */ code = gdev_tiff_begin_page(tfdev, file); if (code < 0) @@ -1585,7 +1585,7 @@ tiffsep_print_page(gx_device_printer * pdev, FILE * file) if (pdev->height > ((long) 0xFFFFFFFF - ftell(file))/(pdev->width*4)) /* note width is never 0 in print_page */ { dprintf("CMYK composite file would be too large! Reduce resolution.\n"); - return_error(gs_error_rangecheck); /* this will overflow max_long */ + return_error(gs_error_rangecheck); /* this will overflow 32 bits */ } if (gdev_prn_file_is_new(pdev)) { @@ -1638,8 +1638,8 @@ tiffsep_print_page(gx_device_printer * pdev, FILE * file) pdev->color_info.depth = 8; /* Create files for 8 bit gray */ pdev->color_info.num_components = 1; - if (pdev->height > (max_long - ftell(file))/(pdev->width)) /* note width is never 0 in print_page */ - return_error(gs_error_rangecheck); /* this will overflow max_long */ + if (pdev->height > ((long) 0xFFFFFFFF - ftell(file))/(pdev->width)) /* note width is never 0 in print_page */ + return_error(gs_error_rangecheck); /* this will overflow aax_long */ code = tiff_set_fields_for_printer(pdev, tfdev->tiff[comp_num], 1, 0); tiff_set_gray_fields(pdev, tfdev->tiff[comp_num], 8, tfdev->Compression, tfdev->MaxStripSize); |