Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
a34c2349
Commit
a34c2349
authored
Feb 14, 2005
by
Marcus Meissner
Committed by
Alexandre Julliard
Feb 14, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for overflows with ClrUsed.
parent
30ed1000
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
3 deletions
+15
-3
dib.c
dlls/gdi/dib.c
+1
-0
olepicture.c
dlls/oleaut32/olepicture.c
+10
-3
ps.c
dlls/wineps/ps.c
+1
-0
cursoricon.c
windows/cursoricon.c
+3
-0
No files found.
dlls/gdi/dib.c
View file @
a34c2349
...
...
@@ -133,6 +133,7 @@ int DIB_BitmapInfoSize( const BITMAPINFO * info, WORD coloruse )
else
/* assume BITMAPINFOHEADER */
{
colors
=
info
->
bmiHeader
.
biClrUsed
;
if
(
colors
>
256
)
colors
=
256
;
if
(
!
colors
&&
(
info
->
bmiHeader
.
biBitCount
<=
8
))
colors
=
1
<<
info
->
bmiHeader
.
biBitCount
;
return
sizeof
(
BITMAPINFOHEADER
)
+
colors
*
...
...
dlls/oleaut32/olepicture.c
View file @
a34c2349
...
...
@@ -1514,9 +1514,15 @@ static int serializeBMP(HBITMAP hBitmap, void ** ppBuffer, unsigned int * pLengt
GetDIBits
(
hDC
,
hBitmap
,
0
,
pInfoBitmap
->
bmiHeader
.
biHeight
,
pPixelData
,
pInfoBitmap
,
DIB_RGB_COLORS
);
/* Calculate the total length required for the BMP data */
if
(
pInfoBitmap
->
bmiHeader
.
biClrUsed
!=
0
)
iNumPaletteEntries
=
pInfoBitmap
->
bmiHeader
.
biClrUsed
;
else
if
(
pInfoBitmap
->
bmiHeader
.
biBitCount
<=
8
)
iNumPaletteEntries
=
1
<<
pInfoBitmap
->
bmiHeader
.
biBitCount
;
else
iNumPaletteEntries
=
0
;
if
(
pInfoBitmap
->
bmiHeader
.
biClrUsed
!=
0
)
{
iNumPaletteEntries
=
pInfoBitmap
->
bmiHeader
.
biClrUsed
;
if
(
iNumPaletteEntries
>
256
)
iNumPaletteEntries
=
256
;
}
else
{
if
(
pInfoBitmap
->
bmiHeader
.
biBitCount
<=
8
)
iNumPaletteEntries
=
1
<<
pInfoBitmap
->
bmiHeader
.
biBitCount
;
else
iNumPaletteEntries
=
0
;
}
*
pLength
=
sizeof
(
BITMAPFILEHEADER
)
+
sizeof
(
BITMAPINFOHEADER
)
+
...
...
@@ -1624,6 +1630,7 @@ static int serializeIcon(HICON hIcon, void ** ppBuffer, unsigned int * pLength)
||
(
pInfoBitmap
->
bmiHeader
.
biBitCount
==
24
)
||
(
pInfoBitmap
->
bmiHeader
.
biBitCount
==
32
&&
pInfoBitmap
->
bmiHeader
.
biCompression
==
BI_RGB
))
{
iNumEntriesPalette
=
pInfoBitmap
->
bmiHeader
.
biClrUsed
;
if
(
iNumEntriesPalette
>
256
)
iNumEntriesPalette
=
256
;
}
else
if
((
pInfoBitmap
->
bmiHeader
.
biBitCount
==
16
||
pInfoBitmap
->
bmiHeader
.
biBitCount
==
32
)
&&
pInfoBitmap
->
bmiHeader
.
biCompression
==
BI_BITFIELDS
)
{
iNumEntriesPalette
=
3
;
...
...
dlls/wineps/ps.c
View file @
a34c2349
...
...
@@ -854,6 +854,7 @@ BOOL PSDRV_WriteDIBPatternDict(PSDRV_PDEVICE *physDev, BITMAPINFO *bmi, UINT usa
bits
=
(
char
*
)
bmi
+
bmi
->
bmiHeader
.
biSize
;
colours
=
bmi
->
bmiHeader
.
biClrUsed
;
if
(
colours
>
256
)
colours
=
256
;
if
(
!
colours
&&
bmi
->
bmiHeader
.
biBitCount
<=
8
)
colours
=
1
<<
bmi
->
bmiHeader
.
biBitCount
;
bits
+=
colours
*
((
usage
==
DIB_RGB_COLORS
)
?
...
...
windows/cursoricon.c
View file @
a34c2349
...
...
@@ -219,6 +219,8 @@ static int bitmap_info_size( const BITMAPINFO * info, WORD coloruse )
else
/* assume BITMAPINFOHEADER */
{
colors
=
info
->
bmiHeader
.
biClrUsed
;
if
(
colors
>
256
)
/* buffer overflow otherwise */
colors
=
256
;
if
(
!
colors
&&
(
info
->
bmiHeader
.
biBitCount
<=
8
))
colors
=
1
<<
info
->
bmiHeader
.
biBitCount
;
return
sizeof
(
BITMAPINFOHEADER
)
+
colors
*
...
...
@@ -2043,6 +2045,7 @@ static void DIB_FixColorsToLoadflags(BITMAPINFO * bmi, UINT loadflags, BYTE pix)
{
incr
=
4
;
colors
=
bmi
->
bmiHeader
.
biClrUsed
;
if
(
colors
>
256
)
colors
=
256
;
if
(
!
colors
&&
(
bpp
<=
8
))
colors
=
1
<<
bpp
;
}
...
...
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