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
97a2ca5d
Kaydet (Commit)
97a2ca5d
authored
Eyl 29, 2015
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
coverity#1242658 Untrusted loop bound
Change-Id: I0a279e47a4d87f561f39d5a8ca65fa17e2bc4a65
üst
6a0adc9a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
14 deletions
+18
-14
ipict.cxx
filter/source/graphicfilter/ipict/ipict.cxx
+18
-14
No files found.
filter/source/graphicfilter/ipict/ipict.cxx
Dosyayı görüntüle @
97a2ca5d
...
@@ -84,16 +84,15 @@ namespace PictReaderInternal {
...
@@ -84,16 +84,15 @@ namespace PictReaderInternal {
};
};
sal_uLong
Pattern
::
read
(
SvStream
&
stream
)
{
sal_uLong
Pattern
::
read
(
SvStream
&
stream
)
{
short
nx
,
ny
;
unsigned
char
nbyte
[
8
];
unsigned
char
nbyte
[
8
];
sal_uLong
nHiBytes
,
nLoBytes
;
sal_uLong
nHiBytes
,
nLoBytes
;
isColor
=
false
;
isColor
=
false
;
// count the no of bits in pattern which are set to 1:
// count the no of bits in pattern which are set to 1:
nBitCount
=
0
;
nBitCount
=
0
;
for
(
ny
=
0
;
ny
<
8
;
ny
++
)
{
for
(
short
ny
=
0
;
ny
<
8
;
ny
++
)
{
stream
.
ReadChar
(
reinterpret_cast
<
char
&>
(
nbyte
[
ny
])
);
stream
.
ReadChar
(
reinterpret_cast
<
char
&>
(
nbyte
[
ny
])
);
for
(
nx
=
0
;
nx
<
8
;
nx
++
)
{
for
(
short
nx
=
0
;
nx
<
8
;
nx
++
)
{
if
(
(
nbyte
[
ny
]
&
(
1
<<
nx
))
!=
0
)
nBitCount
++
;
if
(
(
nbyte
[
ny
]
&
(
1
<<
nx
))
!=
0
)
nBitCount
++
;
}
}
}
}
...
@@ -706,7 +705,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
...
@@ -706,7 +705,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
Bitmap
aBitmap
;
Bitmap
aBitmap
;
BitmapWriteAccess
*
pAcc
=
NULL
;
BitmapWriteAccess
*
pAcc
=
NULL
;
BitmapReadAccess
*
pReadAcc
=
NULL
;
BitmapReadAccess
*
pReadAcc
=
NULL
;
sal_uInt16
n
y
,
nx
,
n
ColTabSize
;
sal_uInt16
nColTabSize
;
sal_uInt16
nRowBytes
,
nBndX
,
nBndY
,
nWidth
,
nHeight
,
nVersion
,
nPackType
,
nPixelType
,
sal_uInt16
nRowBytes
,
nBndX
,
nBndY
,
nWidth
,
nHeight
,
nVersion
,
nPackType
,
nPixelType
,
nPixelSize
,
nCmpCount
,
nCmpSize
;
nPixelSize
,
nCmpCount
,
nCmpSize
;
sal_uInt32
nPackSize
,
nPlaneBytes
,
nHRes
,
nVRes
;
sal_uInt32
nPackSize
,
nPlaneBytes
,
nHRes
,
nVRes
;
...
@@ -835,9 +834,14 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
...
@@ -835,9 +834,14 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
if
(
nRowBytes
<
nSrcBPL
||
nRowBytes
>
nDestBPL
)
if
(
nRowBytes
<
nSrcBPL
||
nRowBytes
>
nDestBPL
)
BITMAPERROR
;
BITMAPERROR
;
for
(
ny
=
0
;
ny
<
nHeight
;
ny
++
)
if
(
nRowBytes
<
8
||
nPackType
==
1
)
{
if
(
pPict
->
remainingSize
()
<
sizeof
(
sal_uInt8
)
*
nHeight
*
nRowBytes
)
BITMAPERROR
;
}
for
(
sal_uInt16
ny
=
0
;
ny
<
nHeight
;
++
ny
)
{
{
nx
=
0
;
sal_uInt16
nx
=
0
;
if
(
nRowBytes
<
8
||
nPackType
==
1
)
if
(
nRowBytes
<
8
||
nPackType
==
1
)
{
{
for
(
i
=
0
;
i
<
nRowBytes
;
i
++
)
for
(
i
=
0
;
i
<
nRowBytes
;
i
++
)
...
@@ -908,9 +912,9 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
...
@@ -908,9 +912,9 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
BITMAPERROR
;
BITMAPERROR
;
}
}
for
(
ny
=
0
;
ny
<
nHeight
;
ny
++
)
for
(
sal_uInt16
ny
=
0
;
ny
<
nHeight
;
++
ny
)
{
{
nx
=
0
;
sal_uInt16
nx
=
0
;
if
(
nRowBytes
<
8
||
nPackType
==
1
)
if
(
nRowBytes
<
8
||
nPackType
==
1
)
{
{
for
(
i
=
0
;
i
<
nWidth
;
i
++
)
for
(
i
=
0
;
i
<
nWidth
;
i
++
)
...
@@ -1005,9 +1009,9 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
...
@@ -1005,9 +1009,9 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
if
(
nWidth
>
nMaxCols
)
if
(
nWidth
>
nMaxCols
)
BITMAPERROR
;
BITMAPERROR
;
for
(
ny
=
0
;
ny
<
nHeight
;
ny
++
)
for
(
sal_uInt16
ny
=
0
;
ny
<
nHeight
;
++
ny
)
{
{
for
(
nx
=
0
;
nx
<
nWidth
;
nx
++
)
for
(
sal_uInt16
nx
=
0
;
nx
<
nWidth
;
++
nx
)
{
{
pPict
->
ReadUChar
(
nDummy
).
ReadUChar
(
nRed
).
ReadUChar
(
nGreen
).
ReadUChar
(
nBlue
);
pPict
->
ReadUChar
(
nDummy
).
ReadUChar
(
nRed
).
ReadUChar
(
nGreen
).
ReadUChar
(
nBlue
);
pAcc
->
SetPixel
(
ny
,
nx
,
BitmapColor
(
nRed
,
nGreen
,
nBlue
)
);
pAcc
->
SetPixel
(
ny
,
nx
,
BitmapColor
(
nRed
,
nGreen
,
nBlue
)
);
...
@@ -1025,9 +1029,9 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
...
@@ -1025,9 +1029,9 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
if
(
nWidth
>
nMaxCols
)
if
(
nWidth
>
nMaxCols
)
BITMAPERROR
;
BITMAPERROR
;
for
(
ny
=
0
;
ny
<
nHeight
;
ny
++
)
for
(
sal_uInt16
ny
=
0
;
ny
<
nHeight
;
++
ny
)
{
{
for
(
nx
=
0
;
nx
<
nWidth
;
nx
++
)
for
(
sal_uInt16
nx
=
0
;
nx
<
nWidth
;
++
nx
)
{
{
pPict
->
ReadUChar
(
nRed
).
ReadUChar
(
nGreen
).
ReadUChar
(
nBlue
);
pPict
->
ReadUChar
(
nRed
).
ReadUChar
(
nGreen
).
ReadUChar
(
nBlue
);
pAcc
->
SetPixel
(
ny
,
nx
,
BitmapColor
(
nRed
,
nGreen
,
nBlue
)
);
pAcc
->
SetPixel
(
ny
,
nx
,
BitmapColor
(
nRed
,
nGreen
,
nBlue
)
);
...
@@ -1040,7 +1044,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
...
@@ -1040,7 +1044,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
if
(
(
nCmpCount
==
3
)
||
(
nCmpCount
==
4
)
)
if
(
(
nCmpCount
==
3
)
||
(
nCmpCount
==
4
)
)
{
{
std
::
unique_ptr
<
sal_uInt8
[]
>
pScanline
(
new
sal_uInt8
[
static_cast
<
size_t
>
(
nWidth
)
*
nCmpCount
]);
std
::
unique_ptr
<
sal_uInt8
[]
>
pScanline
(
new
sal_uInt8
[
static_cast
<
size_t
>
(
nWidth
)
*
nCmpCount
]);
for
(
ny
=
0
;
ny
<
nHeight
;
ny
++
)
for
(
sal_uInt16
ny
=
0
;
ny
<
nHeight
;
++
ny
)
{
{
nSrcBitsPos
=
pPict
->
Tell
();
nSrcBitsPos
=
pPict
->
Tell
();
if
(
nRowBytes
>
250
)
if
(
nRowBytes
>
250
)
...
@@ -1086,7 +1090,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
...
@@ -1086,7 +1090,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
sal_uInt8
*
pTmp
=
pScanline
.
get
();
sal_uInt8
*
pTmp
=
pScanline
.
get
();
if
(
nCmpCount
==
4
)
if
(
nCmpCount
==
4
)
pTmp
+=
nWidth
;
pTmp
+=
nWidth
;
for
(
nx
=
0
;
nx
<
nWidth
;
pTmp
++
)
for
(
sal_uInt16
nx
=
0
;
nx
<
nWidth
;
pTmp
++
)
pAcc
->
SetPixel
(
ny
,
nx
++
,
BitmapColor
(
*
pTmp
,
pTmp
[
nWidth
],
pTmp
[
2
*
nWidth
]
)
);
pAcc
->
SetPixel
(
ny
,
nx
++
,
BitmapColor
(
*
pTmp
,
pTmp
[
nWidth
],
pTmp
[
2
*
nWidth
]
)
);
nDataSize
+=
(
sal_uLong
)
nByteCount
;
nDataSize
+=
(
sal_uLong
)
nByteCount
;
pPict
->
Seek
(
nSrcBitsPos
+
(
sal_uLong
)
nByteCount
);
pPict
->
Seek
(
nSrcBitsPos
+
(
sal_uLong
)
nByteCount
);
...
...
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