From c5cb5654c96ce38e4040e7efcae084acd261f0ac Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 17 Jul 2017 20:36:31 +0530 Subject: [PATCH] Comic input: Fix a bug in the normalize image filter that caused a crash when converting comics that contain a page with only a single color. Fixes #1704778 [Issue converting CBR into PDF](https://bugs.launchpad.net/calibre/+bug/1704778) --- src/calibre/utils/imageops/imageops.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/utils/imageops/imageops.cpp b/src/calibre/utils/imageops/imageops.cpp index 1f731d344f..a7f363e0fc 100644 --- a/src/calibre/utils/imageops/imageops.cpp +++ b/src/calibre/utils/imageops/imageops.cpp @@ -684,7 +684,7 @@ QImage normalize(const QImage &image) { // {{{ break; } memset(&intensity, 0, sizeof(IntegerPixel)); - for(high.green=high.red; high.green != low.red; --high.green){ + for(high.green=high.red; high.green > low.red; --high.green){ intensity.green += histogram[high.green].green; if(intensity.green > threshold_intensity) break; @@ -696,7 +696,7 @@ QImage normalize(const QImage &image) { // {{{ break; } memset(&intensity, 0, sizeof(IntegerPixel)); - for(high.blue=high.green; high.blue != low.green; --high.blue){ + for(high.blue=high.green; high.blue > low.green; --high.blue){ intensity.blue += histogram[high.blue].blue; if(intensity.blue > threshold_intensity) break;