Skip to content

Division by zero #688

@CryptoPirat3

Description

@CryptoPirat3

Describe the bug
Program doesn't check if parameter xsize equal to zero. It leads to Arithmetic exception

To Reproduce
Steps to reproduce the behavior:

  1. First of all build from sources cups-filters-2.0.1, libcupsfilters-2.1.1, libppd-2.1.1, pdfio-1.6.1
  2. Run imagetoraster with Crash seed (finding 278).txt file

Expected behavior
Normal completion of excecutable

Source

    132        z->height  = xc1 - xc0 + 1;
    133        z->xsize   = xsize;
    134        z->ysize   = ysize;
    135        z->xmod    = z->width % z->xsize;
--->136        z->xstep   = z->width / z->xsize;
    137        z->xincr   = 1;
    138        z->ymod    = z->height % z->ysize;
    139        z->ystep   = z->height / z->ysize;
    140        z->yincr   = 1;
    141        z->instep  = z->xstep * z->depth;

Executable log

#0  0x0000555555686f88 in _cfImageZoomNew (img=0x55555598d5c0, xc0=0, yc0=0, xc1=xc1@entry=767, yc1=<optimized out>, xsize=0, ysize=3000, rotated=1, type=CF_IZOOM_NORMAL) at /src/libcupsfilters-2.1.1/cupsfilters/image-zoom.c:136
#1  0x00005555555f99e7 in cfFilterImageToRaster (inputfd=inputfd@entry=3, outputfd=<optimized out>, outputfd@entry=1, inputseekable=inputseekable@entry=1, data=data@entry=0x7fffffffc668, parameters=parameters@entry=0x0) at /src/libcupsfilters-2.1.1/cupsfilters/imagetoraster.c:1678
#2  0x0000555555566202 in ppdFilterCUPSWrapper (argc=argc@entry=7, argv=argv@entry=0x7fffffffc978, filter=0x5555555f3f10 <cfFilterImageToRaster>, parameters=parameters@entry=0x0, JobCanceled=0x55555570ac90 <JobCanceled>) at /src/libppd-2.1.1/ppd/ppd-filter.c:179
#3  0x0000555555565cd4 in main (argc=7, argv=0x7fffffffc978) at /src/cups-filters/filter/imagetoraster.c:73

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions