Summary: | Digikam Fingerprinter crashes | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Stephen S <sayno2quat> |
Component: | Searches-Similarity | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | caulier.gilles, daniel, vasile.jureschi |
Priority: | NOR | ||
Version: | 1.7.0 | ||
Target Milestone: | --- | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 1.8.0 | |
Sentry Crash Report: | |||
Attachments: |
Testcase that crashes the fingerprinter.
Handle Qt::KeepAspectRatio scaling the destination width/height to zero in DImg::smoothScale New crash information added by DrKonqi |
Description
Stephen S
2010-12-22 23:51:04 UTC
Stephen, Can you identify the file which crash digiKam during duplicate scan ? Enable debug output using kdebugdialog and turning digikam debug spaces. Run digiKam into a console and look messages printed. Typically, we have fixed this problem with 1.6.0. Look report here : https://bugs.kde.org/show_bug.cgi?id=207710 Daniel, I CC you for info. Look like not all case have been fixed in DImgScale implementation. Thanks in advance for your help... Gilles Caulier The problem seems to be a 1-pixel high image being scaled down and the destination height being calculatet as 0, leading to divide by zero and possibly other errors later on. This could be caused by Digikam::FingerPrintsGenerator::slotGotImagePreview passing 0 as the dh parameter. More likely though, the this is caused by the newSize.scale( QSize(dw, dh), aspectRatioMode ); in Digikam::DImg::smoothScale always rounding down the result. To solve this, you need to check if the calculated dh or dw are equal to zero and then either abort (since the new image has zero height/width there is nothing to du) or better yet just bump the height/width up to a minimum of one (a thumbnail with only one row of pixels is still more useful than an empty thumbnail, no?). So that would mean to add in Digikam::DImg::smoothScale after dw = newSize.width(); dh = newSize.height(); add if(dw == 0) { dw = 1; } if(dh == 0) { dh = 1; } Because I don't have the source code checked out right now (and don't have time to do so) I can't provide proper diff file or test the changes myself, but just adding thos chechs for dw == 0 and dh == 0 should fix this crash. Note that this change will result in Digikam::DImg::smoothScale always returning an image width width and height of at least one, even if the passed dw and/or dh are zero, which may or may not be desirable. However, this should not break any existing uses of the smoothScale, as passing 0 as dw or dh results in a crash without this change. Happy holidays, Daniel Thanks Daniel for this solution. Marcel, Andi, your viewpoint ? Gilles Stephen: It's a picture with width=134 and height=1 or multiples thereof. Panorama? Daniel: I think passing an image of width or height 0 is caught somewhere. It's simple, when given a null image it returns a null image. (In reply to comment #4) > Daniel: I think passing an image of width or height 0 is caught somewhere. It's > simple, when given a null image it returns a null image. Yes, passing dw=0 an/or dh=0 is handled by smoothScale(). However, when passing Qt::KeepAspectRatio as aspectRatioMode (the fringerprinter does this when generating the status thumbnail), dw or dh may still be scaled down to zero and this is not handled. Created attachment 55307 [details]
Testcase that crashes the fingerprinter.
This image crashes digikam when generating fingerprints with the same backtrace as provided in this bug. The crash only happens the once when rebuilding fingerprints (until 'touch fingerprinter-test.png'-ing it so it will be fingerprinted again).
Created attachment 55308 [details]
Handle Qt::KeepAspectRatio scaling the destination width/height to zero in DImg::smoothScale
This fixes the crash caused by attached image.
SVN commit 1210103 by cgilles: apply patch #55308 BUGS: 261015 M +1 -1 dimgscale.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=1210103 Created attachment 57719 [details]
New crash information added by DrKonqi
digikam (1.4.0) on KDE Platform 4.5.1 (KDE 4.5.1) using Qt 4.7.0
Crashed while rebuilding the fingerprints database.
-- Backtrace (Reduced):
#7 0x0509f233 in Digikam::DImgScale::dimgCalcYPoints (src=0x97ccb860, sw=138, sh=1, dh=0) at /build/buildd/digikam-1.4.0/libs/dimg/dimgscale.cpp:296
#8 0x0509f462 in Digikam::DImgScale::dimgCalcScaleInfo (img=..., sw=138, sh=1, dw=128, dh=0, aa=true) at /build/buildd/digikam-1.4.0/libs/dimg/dimgscale.cpp:417
#9 0x0509f9f6 in Digikam::DImg::smoothScale (this=0xbfb1dcfc, dw=128, dh=128, aspectRatioMode=Qt::KeepAspectRatio) at /build/buildd/digikam-1.4.0/libs/dimg/dimgscale.cpp:128
#10 0x08186956 in Digikam::FingerPrintsGenerator::slotGotImagePreview (this=0xb2cb1438, desc=..., img=...) at /build/buildd/digikam-1.4.0/utilities/batch/fingerprintsgenerator.cpp:174
#11 0x08186b0b in Digikam::FingerPrintsGenerator::qt_metacall (this=0xb2cb1438, _c=QMetaObject::InvokeMetaMethod, _id=86, _a=0xa0b18520) at /build/buildd/digikam-1.4.0/obj-i686-linux-gnu/digikam/fingerprintsgenerator.moc:83
It's have been already fixed. Please update to last stable 1.9.0. digiKam 1.4.0 is too old Gilles Caulier |