Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] QtCustomPlot: New Defects reported by Coverity Scan for Wireshar

From: Jaap Keuter <jaap.keuter@xxxxxxxxx>
Date: Fri, 20 Sep 2019 14:12:16 +0200
Hi Alexis, Roland, 

I assume you are aware of these:

Begin forwarded message:

Subject: New Defects reported by Coverity Scan for Wireshark
Date: 20 September 2019 at 07:46:10 CEST


...


** CID 1453859:    (DIVIDE_BY_ZERO)


________________________________________________________________________________________________________
*** CID 1453859:    (DIVIDE_BY_ZERO)
/home/wireshark/builders/wireshark-master-fuzz/clangcodeanalysis/build/ui/qt/widgets/qcustomplot.cpp: 20769 in QCPGraph::dataToImpulseLines(const QVector<QCPGraphData> &) const()
20763       // transform data points to pixels:
20764       if (keyAxis->orientation() == Qt::Vertical)
20765       {
20766         for (int i=0; i<data.size(); ++i)
20767         {
20768           const double key = keyAxis->coordToPixel(data.at(i).key);
   CID 1453859:    (DIVIDE_BY_ZERO)
   In function call "coordToPixel", division by _expression_ "0." has undefined behavior.
20769           result[i*2+0].setX(valueAxis->coordToPixel(0));
20770           result[i*2+0].setY(key);
20771           result[i*2+1].setX(valueAxis->coordToPixel(data.at(i).value));
20772           result[i*2+1].setY(key);
20773         }
20774       } else // key axis is horizontal
/home/wireshark/builders/wireshark-master-fuzz/clangcodeanalysis/build/ui/qt/widgets/qcustomplot.cpp: 20780 in QCPGraph::dataToImpulseLines(const QVector<QCPGraphData> &) const()
20774       } else // key axis is horizontal
20775       {
20776         for (int i=0; i<data.size(); ++i)
20777         {
20778           const double key = keyAxis->coordToPixel(data.at(i).key);
20779           result[i*2+0].setX(key);
   CID 1453859:    (DIVIDE_BY_ZERO)
   In function call "coordToPixel", division by _expression_ "0." has undefined behavior.
20780           result[i*2+0].setY(valueAxis->coordToPixel(0));
20781           result[i*2+1].setX(key);
20782           result[i*2+1].setY(valueAxis->coordToPixel(data.at(i).value));
20783         }
20784       }
20785       return result;