[kdiff3] [Bug 487338] Possible regression: Floating point exception

simon bugzilla_noreply at kde.org
Sat Jun 29 12:55:32 BST 2024


https://bugs.kde.org/show_bug.cgi?id=487338

simon <mapper74 at outlook.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mapper74 at outlook.com

--- Comment #9 from simon <mapper74 at outlook.com> ---
I can also reproduce this.

OS: Gentoo Linux amd64
kdiff3 version: 1.11.1
KDE Frameworks Version: 5.116.0
Qt Version: 5.15.14
Graphics Platform: Wayland

Thread 1 "kdiff3" received signal SIGFPE, Arithmetic exception.
0x00005555555ef793 in getBestFirstLine (line=..., nofLines=nofLines at entry=2,
firstLine=..., visibleLines=visibleLines at entry=0)
    at
/usr/src/debug/kde-misc/kdiff3-1.11.1/kdiff3-1.11.1/src/difftextwindow.cpp:589
589             newFirstLine = std::max(0, line - (visibleLines * numberPages)
/ 3);
(gdb) p visibleLines
$1 = 0
(gdb) list
584         if(nofLines < visibleLines)
585             newFirstLine = std::max(0, (LineType)std::ceil(line -
(visibleLines - nofLines) / 2));
586         else
587         {
588             qint32 numberPages = floor(nofLines / visibleLines);
589             newFirstLine = std::max(0, line - (visibleLines * numberPages)
/ 3);
590         }
591         return newFirstLine;
592     }
593
(gdb) bt
#0  0x00005555555ef793 in getBestFirstLine (line=...,
nofLines=nofLines at entry=2, firstLine=...,
    visibleLines=visibleLines at entry=0) at
/usr/src/debug/kde-misc/kdiff3-1.11.1/kdiff3-1.11.1/src/difftextwindow.cpp:589
#1  0x00005555555ef8e0 in DiffTextWindow::setFastSelectorRange
(this=0x555555cbc1a0, line1=<optimized out>,
    nofLines=<optimized out>) at
/usr/src/debug/kde-misc/kdiff3-1.11.1/kdiff3-1.11.1/src/difftextwindow.cpp:600
#2  0x00007ffff68ae4c6 in void doActivate<false>(QObject*, int, void**) () from
/usr/lib64/libQt5Core.so.5
#3  0x000055555559afd6 in MergeResultWindow::setFastSelectorRange
(this=this at entry=0x555555b97930, _t1=..., _t2=<optimized out>)
    at
/usr/src/debug/kde-misc/kdiff3-1.11.1/kdiff3-1.11.1_build/src/kdiff3_autogen/EWIEGA46WW/moc_mergeresultwindow.cpp:476
#4  0x000055555561ca12 in MergeResultWindow::setFastSelector
(this=0x555555b97930, i=...)
    at /usr/include/boost/safe_numerics/checked_result.hpp:26
#5  0x000055555561e233 in MergeResultWindow::slotGoTop (this=0x555555b97930)
    at
/usr/src/debug/kde-misc/kdiff3-1.11.1/kdiff3-1.11.1/src/mergeresultwindow.cpp:677
#6  MergeResultWindow::merge (this=0x555555b97930, bAutoSolve=true,
defaultSelector=<optimized out>, bConflictsOnly=false,
    bWhiteSpaceOnly=<optimized out>) at
/usr/src/debug/kde-misc/kdiff3-1.11.1/kdiff3-1.11.1/src/mergeresultwindow.cpp:416
#7  0x000055555561e5cc in MergeResultWindow::init (this=0x555555b97930,
pLineDataA=..., sizeA=..., pLineDataB=..., sizeB=...,
    pLineDataC=..., sizeC=..., pDiff3LineList=0x555555748450,
pTotalDiffStatus=0x555555748f60, bAutoSolve=true)
    at
/usr/src/debug/kde-misc/kdiff3-1.11.1/kdiff3-1.11.1/src/mergeresultwindow.cpp:132
#8  0x00005555555dca66 in KDiff3App::mainInit (this=this at entry=0x555555748000,
pTotalDiffStatus=0x555555748f60, inFlags=...,
    inFlags at entry=...) at
/usr/src/debug/kde-misc/kdiff3-1.11.1/kdiff3-1.11.1/src/pdiff.cpp:380
#9  0x00005555555acf02 in KDiff3App::doFileCompare (this=0x555555748000) at
/usr/include/qt5/QtCore/qflags.h:121
#10 KDiff3App::completeInit (this=0x555555748000, fn1=..., fn2=..., fn3=...)
    at /usr/src/debug/kde-misc/kdiff3-1.11.1/kdiff3-1.11.1/src/kdiff3.cpp:493
#11 0x00005555555a39f0 in KDiff3Shell::KDiff3Shell (this=0x555555738ba0,
fn1=..., fn2=..., fn3=..., __in_chrg=<optimized out>,
    __vtt_parm=<optimized out>) at
/usr/src/debug/kde-misc/kdiff3-1.11.1/kdiff3-1.11.1/src/kdiff3_shell.cpp:39
#12 0x00005555555a1bb0 in operator() (__closure=0x5555557432d0)
    at /usr/src/debug/kde-misc/kdiff3-1.11.1/kdiff3-1.11.1/src/main.cpp:195
#13 QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void,
main(qint32, char**)::<lambda()> >::call (
    arg=<optimized out>, f=...) at
/usr/include/qt5/QtCore/qobjectdefs_impl.h:146
#14 QtPrivate::Functor<main(qint32, char**)::<lambda()>,
0>::call<QtPrivate::List<>, void> (arg=<optimized out>, f=...)
    at /usr/include/qt5/QtCore/qobjectdefs_impl.h:256
#15 QtPrivate::QFunctorSlotObject<main(qint32, char**)::<lambda()>, 0,
QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *,
void **, bool *) (which=<optimized out>, this_=0x5555557432c0, r=<optimized
out>, a=<optimized
out>,
    ret=<optimized out>) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:443
#16 0x00007ffff68a4d7e in QObject::event(QEvent*) () from
/usr/lib64/libQt5Core.so.5
#17 0x00007ffff72fa1fe in QApplicationPrivate::notify_helper(QObject*, QEvent*)
() from /usr/lib64/libQt5Widgets.so.5
#18 0x00007ffff687aee8 in QCoreApplication::notifyInternal2(QObject*, QEvent*)
() from /usr/lib64/libQt5Core.so.5
#19 0x00007ffff687e3c3 in QCoreApplicationPrivate::sendPostedEvents(QObject*,
int, QThreadData*) ()
   from /usr/lib64/libQt5Core.so.5
#20 0x00007ffff68cc473 in postEventSourceDispatch(_GSource*, int (*)(void*),
void*) () from /usr/lib64/libQt5Core.so.5
#21 0x00007ffff5521ff2 in g_main_dispatch () from /usr/lib64/libglib-2.0.so.0
#22 0x00007ffff55251a7 in g_main_context_iterate_unlocked.isra () from
/usr/lib64/libglib-2.0.so.0
#23 0x00007ffff55257cc in g_main_context_iteration () from
/usr/lib64/libglib-2.0.so.0


This looks like an integer divide-by-zero in getBestFirstLine. I am using the
following workaround to prevent the crash:

--- A/src/difftextwindow.cpp
+++ B/src/difftextwindow.cpp
@@ -583,7 +583,7 @@

     if(nofLines < visibleLines)
         newFirstLine = std::max(0, (LineType)std::ceil(line - (visibleLines -
nofLines) / 2));
-    else
+    else if(visibleLines > 0)
     {
         qint32 numberPages = floor(nofLines / visibleLines);
         newFirstLine = std::max(0, line - (visibleLines * numberPages) / 3);

-- 
You are receiving this mail because:
You are watching all bug changes.



More information about the kde-mac mailing list