Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
54ba9587
Kaydet (Commit)
54ba9587
authored
Eki 29, 2014
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
coverity#1202781 Division or modulo by zero
Change-Id: I2908c57badd079c8f19c679f40ed815ce2cba374
üst
b7e999e2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
12 deletions
+49
-12
epict.cxx
filter/source/graphicfilter/epict/epict.cxx
+2
-2
numeric.hxx
include/o3tl/numeric.hxx
+28
-0
imap.cxx
svtools/source/misc/imap.cxx
+2
-2
ndtbl.cxx
sw/source/core/docnode/ndtbl.cxx
+15
-7
DomainMapperTableManager.cxx
writerfilter/source/dmapper/DomainMapperTableManager.cxx
+2
-1
No files found.
filter/source/graphicfilter/epict/epict.cxx
Dosyayı görüntüle @
54ba9587
...
...
@@ -34,7 +34,7 @@
#include <vcl/msgbox.hxx>
#include <vcl/gdimtf.hxx>
#include <tools/bigint.hxx>
#include <o3tl/numeric.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <boost/scoped_array.hpp>
...
...
@@ -1758,7 +1758,7 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
if
(
nLength
>
0
)
{
if
(
nNormSize
==
0
)
throw
std
::
runtime_error
(
"divide by zero"
);
throw
o3tl
::
divide_by_zero
(
);
for
(
sal_Int32
i
=
0
;
i
<
nLength
;
++
i
)
pDXAry
[
i
]
=
pDXAry
[
i
]
*
(
(
long
)
pA
->
GetWidth
()
)
/
nNormSize
;
}
...
...
include/o3tl/numeric.hxx
0 → 100644
Dosyayı görüntüle @
54ba9587
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_O3TL_NUMERIC_HXX
#define INCLUDED_O3TL_NUMERIC_HXX
#include <stdexcept>
namespace
o3tl
{
struct
divide_by_zero
:
public
std
::
runtime_error
{
explicit
divide_by_zero
()
:
std
::
runtime_error
(
"divide by zero"
)
{
}
};
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
svtools/source/misc/imap.cxx
Dosyayı görüntüle @
54ba9587
...
...
@@ -22,7 +22,7 @@
#include <vcl/svapp.hxx>
#include <vcl/mapmod.hxx>
#include <vcl/window.hxx>
#include <o3tl/numeric.hxx>
#include <svl/urihelper.hxx>
#include <svtools/imap.hxx>
#include <svtools/imapobj.hxx>
...
...
@@ -384,7 +384,7 @@ void IMapCircleObject::Scale( const Fraction& rFracX, const Fraction& rFracY )
}
if
(
!
aAverage
.
GetDenominator
())
throw
std
::
runtime_error
(
"divide by zero"
);
throw
o3tl
::
divide_by_zero
(
);
nRadius
=
(
nRadius
*
aAverage
.
GetNumerator
()
)
/
aAverage
.
GetDenominator
();
}
...
...
sw/source/core/docnode/ndtbl.cxx
Dosyayı görüntüle @
54ba9587
...
...
@@ -92,6 +92,7 @@
#include <rootfrm.hxx>
#include <fldupde.hxx>
#include <switerator.hxx>
#include <o3tl/numeric.hxx>
#include <boost/foreach.hpp>
#ifdef DBG_UTIL
...
...
@@ -2948,7 +2949,7 @@ const SwTableBox* SwCollectTblLineBoxes::GetBoxOfPos( const SwTableBox& rBox )
bool
SwCollectTblLineBoxes
::
Resize
(
sal_uInt16
nOffset
,
sal_uInt16
nOldWidth
)
{
s
al_uInt16
n
;
s
ize_t
n
;
if
(
!
aPosArr
.
empty
()
)
{
...
...
@@ -2967,13 +2968,20 @@ bool SwCollectTblLineBoxes::Resize( sal_uInt16 nOffset, sal_uInt16 nOldWidth )
aPosArr
.
erase
(
aPosArr
.
begin
(),
aPosArr
.
begin
()
+
n
);
m_Boxes
.
erase
(
m_Boxes
.
begin
(),
m_Boxes
.
begin
()
+
n
);
// Adapt the positions to the new Size
for
(
n
=
0
;
n
<
aPosArr
.
size
();
++
n
)
size_t
nSize
=
aPosArr
.
size
();
if
(
nSize
)
{
sal_uLong
nSize
=
nWidth
;
nSize
*=
(
aPosArr
[
n
]
-
nOffset
);
nSize
/=
nOldWidth
;
aPosArr
[
n
]
=
sal_uInt16
(
nSize
);
if
(
nOldWidth
==
0
)
throw
o3tl
::
divide_by_zero
();
// Adapt the positions to the new Size
for
(
n
=
0
;
n
<
nSize
;
++
n
)
{
sal_uLong
nSize
=
nWidth
;
nSize
*=
(
aPosArr
[
n
]
-
nOffset
);
nSize
/=
nOldWidth
;
aPosArr
[
n
]
=
sal_uInt16
(
nSize
);
}
}
}
return
!
aPosArr
.
empty
();
...
...
writerfilter/source/dmapper/DomainMapperTableManager.cxx
Dosyayı görüntüle @
54ba9587
...
...
@@ -30,6 +30,7 @@
#include <com/sun/star/text/TableColumnSeparator.hpp>
#include <com/sun/star/text/VertOrientation.hpp>
#include <com/sun/star/text/WritingMode2.hpp>
#include <o3tl/numeric.hxx>
#include <ooxml/resourceids.hxx>
#include <dmapperLoggers.hxx>
#include <dmapper/DomainMapper.hxx>
...
...
@@ -791,7 +792,7 @@ void DomainMapperTableManager::endOfRowAction()
if
(
nWidthsBound
)
{
if
(
nFullWidthRelative
==
0
)
throw
std
::
range_error
(
"divide by zero"
);
throw
o3tl
::
divide_by_zero
(
);
for
(
sal_uInt32
i
=
0
;
i
<
nWidthsBound
;
++
i
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment