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)

This commit is contained in:
Kovid Goyal 2017-07-17 20:36:31 +05:30
parent 172e044f3f
commit c5cb5654c9
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -684,7 +684,7 @@ QImage normalize(const QImage &image) { // {{{
break; break;
} }
memset(&intensity, 0, sizeof(IntegerPixel)); 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; intensity.green += histogram[high.green].green;
if(intensity.green > threshold_intensity) if(intensity.green > threshold_intensity)
break; break;
@ -696,7 +696,7 @@ QImage normalize(const QImage &image) { // {{{
break; break;
} }
memset(&intensity, 0, sizeof(IntegerPixel)); 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; intensity.blue += histogram[high.blue].blue;
if(intensity.blue > threshold_intensity) if(intensity.blue > threshold_intensity)
break; break;