[cups-devel] [PATCH 1/2] rastertoepson: handle odd width (width%2==1) properly
Michael Sweet
msweet at apple.com
Mon Apr 6 05:38:21 PDT 2015
This has been filed as CUPS STR #4616:
https://www.cups.org/str.php?L4616
> On Mar 29, 2015, at 12:32 AM, Matthew Ogilvie <mmogilvi_cups at miniinfo.net> wrote:
>
> Without this patch, it would crash, and had been crashing since
> variables were made unsigned in early 2014
> (commit 7e86f2f686334cb3db458b4585dfce9c1b712bc4).
> ---
> filter/rastertoepson.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/filter/rastertoepson.c b/filter/rastertoepson.c
> index 7edd209..572e86d 100644
> --- a/filter/rastertoepson.c
> +++ b/filter/rastertoepson.c
> @@ -655,13 +655,18 @@ OutputLine(
> }
>
> for (width = header->cupsWidth, tempptr = CompBuffer;
> - width > 0;
> + width > 1;
> width -= 2, tempptr += 2, oddptr += DotBytes * 2,
> evenptr += DotBytes * 2)
> {
> evenptr[0] = tempptr[0];
> oddptr[0] = tempptr[1];
> }
> + if (width == 1)
> + {
> + evenptr[0] = tempptr[0];
> + oddptr[0] = tempptr[1];
> + }
> }
> else
> {
> @@ -872,6 +877,10 @@ OutputRows(
> putchar(*ptr);
> putchar(0);
> }
> + if (dot_count % 2 == 1)
> + {
> + putchar(*ptr);
> + }
>
> /*
> * Move the head back and print the odd bytes...
> @@ -901,6 +910,10 @@ OutputRows(
> putchar(0);
> putchar(*ptr);
> }
> + if (dot_count % 2 == 1)
> + {
> + putchar(0);
> + }
> }
> else
> pwrite(dot_ptr, dot_count);
> --
> 2.0.5
>
> _______________________________________________
> cups-devel mailing list
> cups-devel at cups.org
> https://www.cups.org/mailman/listinfo/cups-devel
_________________________________________________________
Michael Sweet, Senior Printing System Engineer, PWG Chair
More information about the cups-devel
mailing list