]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
Fixes offset issues leading to segmentation faults 132/head
authortanmayanand44 <anand44tanmay@gmail.com>
Fri, 5 Jul 2019 13:16:04 +0000 (18:46 +0530)
committertanmayanand44 <anand44tanmay@gmail.com>
Fri, 5 Jul 2019 13:16:04 +0000 (18:46 +0530)
filter/pdftoraster.cxx

index 68275274a30279472c2cc6a135c3f2668d8f1ac4..d3f681089f26497b3879ed5b60137643a21ef6db 100644 (file)
@@ -1597,7 +1597,7 @@ static void writePageImage(cups_raster_t *raster, poppler::document *doc,
    case CUPS_CSPACE_CMY:
    case CUPS_CSPACE_RGBW:
    default:
-   im = pr.render_page(current_page,header.HWResolution[0],header.HWResolution[1],0,0,header.cupsWidth,header.cupsHeight);
+   im = pr.render_page(current_page,header.HWResolution[0],header.HWResolution[1],bitmapoffset[0],bitmapoffset[1],header.cupsWidth,header.cupsHeight);
    newdata = (unsigned char *)malloc(sizeof(char)*3*im.width()*im.height());
    newdata = removeAlpha((unsigned char *)im.const_data(),newdata,im.width(),im.height());
    pixel_count=im.width()*im.height();
@@ -1617,8 +1617,6 @@ static void writePageImage(cups_raster_t *raster, poppler::document *doc,
     for (unsigned int plane = 0;plane < nplanes;plane++) {
       unsigned char *bp = colordata;
 
-      bp += rowsize * (bitmapoffset[1] + header.cupsHeight - 1) +
-        popplerBitsPerPixel * bitmapoffset[0] / 8;
       for (unsigned int h = header.cupsHeight;h > 0;h--) {
         for (unsigned int band = 0;band < nbands;band++) {
           dp = convertLine(bp,lineBuf,h,plane+band,header.cupsWidth,
@@ -1632,8 +1630,6 @@ static void writePageImage(cups_raster_t *raster, poppler::document *doc,
     for (unsigned int plane = 0;plane < nplanes;plane++) {
       unsigned char *bp = colordata;
 
-      bp += rowsize * bitmapoffset[1] +
-        popplerBitsPerPixel * bitmapoffset[0] / 8;
       for (unsigned int h = 0;h < header.cupsHeight;h++) {
         for (unsigned int band = 0;band < nbands;band++) {
           dp = convertLine(bp,lineBuf,h,plane+band,header.cupsWidth,