Bug 257982

Summary: libksane0: Progress bar is stopping while scanning
Product: [Frameworks and Libraries] libksane Reporter: Kai Wb. <curan>
Component: generalAssignee: Kåre Särs <kare.sars>
Status: RESOLVED FIXED    
Severity: normal CC: tuut
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: libksane: proposed patch for bug 257982

Description Kai Wb. 2010-11-26 15:41:24 UTC
Version:           unspecified (using KDE 4.4.5) 
OS:                Linux

As the Debian maintainer for Skanlite I got the following report, but as you (Kâre) agreed by e-mail, this is a libksane bug, therefore I file this against libksane.

Original Debian bug report (#601513):
> While scanning, the progress bar is every time stops at about the half of the
> process, but the scanning is successful.
> Tried with a HP PhotoSmart 5383

Reproducible: Always




Downstream bug report (Debian): http://bugs.debian.org/601513
Comment 1 Gregor Horst 2012-02-14 19:46:04 UTC
Created attachment 68801 [details]
libksane: proposed patch for bug 257982
Comment 2 Gregor Horst 2012-02-14 19:46:54 UTC
I can reproduce this for scanning with resulotions of 600 dpi and higher in color mode.

I think it is an integer overflow in the functions KSanePreviewThread::scanProgress() and KSaneScandThread::scanProgress():
"return (int)((bytesRead * 100)/m_dataSize);"

The attached patch changes the datatype of  bytesRead and m_dataSize to qint64. I think this solves the bug and on the other hand removes the limitation of 2gb maximum size for scanned images.
Comment 3 Kåre Särs 2012-02-15 08:15:16 UTC
Please apply the patch if you want/can :)
Comment 4 Kåre Särs 2012-02-15 20:25:33 UTC
Git commit ed09f4ca7224b5a79147de2a18ac9af3fb1d1d6a by Kåre Särs.
Committed on 15/02/2012 at 21:19.
Pushed by sars into branch 'origin/KDE/4.8'.

Fix wrong scan progress indication while scanning big images.

M  +1    -1    libksane/ksane_preview_thread.cpp
M  +26   -27   libksane/ksane_scan_thread.cpp

http://commits.kde.org/libksane/ed09f4ca7224b5a79147de2a18ac9af3fb1d1d6a
Comment 5 Kåre Särs 2012-02-15 20:40:55 UTC
The commit fixes the scan progress for scans that are over 20 MB. Strange that I have not seen this before...

Unfortunately the 2GB limit on scans can not be fixed on 32bit systems as QByteArray has that limit.