New Defects reported by Coverity Scan for LibreOffice
Caolán McNamara
caolanm at redhat.com
Tue Sep 29 04:17:25 PDT 2015
On Mon, 2015-09-28 at 12:17 -0700, scan-admin at coverity.com wrote:
caolanm->martin:
4fd693f718ac74115ea58208ac3427c01857d260 and
d62dddd6345e8f1730eed1bb2b7183499a85133f are my primitive hacks to
address the two new warnings mentioned below from coverity in the
relatively new graphite layout code. Its probably worth having a look
here (and I've sent a coverity invite if you want to use the web-ui for
these) to see if everything is as it should be
C.
> Hi,
>
> Please find the latest report on new defect(s) introduced to
> LibreOffice found with Coverity Scan.
> *** CID 1325060: Error handling issues (NEGATIVE_RETURNS)
> /vcl/source/glyphs/graphite_layout.cxx: 742 in
> GraphiteLayout::ApplyDXArray(ImplLayoutArgs &, std::vector<int,
> std::allocator<int>> &)()
> 736 for (int n = firstChar; n <= lastChar; ++n)
> 737 if (mvCharDxs[n - mnMinCharPos] != -1)
> 738 mvCharDxs[n - mnMinCharPos] += nDWidth +
> nDGlyphOrigin;
> 739 for (int n = i; n < nLastGlyph; n++)
> 740 mvGlyphs[n].maLinearPos.X() += (nDGlyphOrigin +
> nDWidth) * (bRtl ? -1 : 1);
> 741
> > > > CID 1325060: Error handling issues (NEGATIVE_RETURNS)
> > > > "nBaseGlyph" is passed to a parameter that cannot be
> > > > negative. [Note: The source code implementation of the function
> > > > has been overridden by a builtin model.]
> 742 rDeltaWidth[nBaseGlyph] = nDWidth;
> 743 #ifdef GRLAYOUT_DEBUG
> 744 fprintf(grLog(),"c%d=%d g%d-%d dW%ld-%ld=%ld dX%ld
> x%ld @%d=%d\n", firstChar, lastChar, i, nLastGlyph, nNewClusterWidth,
> nOrigClusterWidth, nDWidth, nDGlyphOrigin,
> mvGlyphs[i].maLinearPos.X(), mvCharDxs[lastChar - mnMinCharPos],
> args.mpDXArray[lastChar - args.mnMinCharPos]);
> 745 #endif
> 746 i = nLastGlyph - 1;
> 747 if (i >= endGi - 1)
>
> ** CID 1325059: (NEGATIVE_RETURNS)
> /vcl/source/glyphs/graphite_layout.cxx: 693 in
> GraphiteLayout::ApplyDXArray(ImplLayoutArgs &, std::vector<int,
> std::allocator<int>> &)()
> /vcl/source/glyphs/graphite_layout.cxx: 693 in
> GraphiteLayout::ApplyDXArray(ImplLayoutArgs &, std::vector<int,
> std::allocator<int>> &)()
>
>
> _____________________________________________________________________
> ___________________________________
> *** CID 1325059: (NEGATIVE_RETURNS)
> /vcl/source/glyphs/graphite_layout.cxx: 693 in
> GraphiteLayout::ApplyDXArray(ImplLayoutArgs &, std::vector<int,
> std::allocator<int>> &)()
> 687 fprintf(grLog(),"ApplyDx %d-%d=%d-%d\n", startChar,
> endChar, startGi, endGi);
> 688 #endif
> 689
> 690 for (int i = startGi; i < endGi; ++i)
> 691 {
> 692 // calculate visual cluster bounds
> > > > CID 1325059: (NEGATIVE_RETURNS)
> > > > "i" is passed to a parameter that cannot be negative.
> > > > [Note: The source code implementation of the function has been
> > > > overridden by a builtin model.]
> 693 int firstChar = mvGlyph2Char[i];
> 694 int nBaseGlyph = mvChar2BaseGlyph[firstChar -
> mnMinCharPos];
> 695 while (nBaseGlyph == -1 && i < endGi)
> 696 {
> 697 ++i;
> 698 firstChar = mvGlyph2Char[i];
> /vcl/source/glyphs/graphite_layout.cxx: 693 in
> GraphiteLayout::ApplyDXArray(ImplLayoutArgs &, std::vector<int,
> std::allocator<int>> &)()
> 687 fprintf(grLog(),"ApplyDx %d-%d=%d-%d\n", startChar,
> endChar, startGi, endGi);
> 688 #endif
> 689
> 690 for (int i = startGi; i < endGi; ++i)
> 691 {
> 692 // calculate visual cluster bounds
> > > > CID 1325059: (NEGATIVE_RETURNS)
> > > > "i" is passed to a parameter that cannot be negative.
> > > > [Note: The source code implementation of the function has been
> > > > overridden by a builtin model.]
> 693 int firstChar = mvGlyph2Char[i];
> 694 int nBaseGlyph = mvChar2BaseGlyph[firstChar -
> mnMinCharPos];
> 695 while (nBaseGlyph == -1 && i < endGi)
> 696 {
> 697 ++i;
> 698 firstChar = mvGlyph2Char[i];
More information about the LibreOffice
mailing list