Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
d7b94684
Commit
d7b94684
authored
Jun 17, 2015
by
Erwan Tulou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skins2: add check on bitmaps to avoid crash
parent
21a146d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
22 deletions
+27
-22
modules/gui/skins2/parser/builder.cpp
modules/gui/skins2/parser/builder.cpp
+27
-22
No files found.
modules/gui/skins2/parser/builder.cpp
View file @
d7b94684
...
...
@@ -132,7 +132,7 @@ Theme *Builder::build()
// Macro to get a bitmap by its ID in the builder
#define GET_BMP( pBmp, id ) \
#define GET_BMP( pBmp, id
, abort
) \
if( id != "none" ) \
{ \
pBmp = m_pTheme->getBitmapById(id); \
...
...
@@ -141,6 +141,11 @@ Theme *Builder::build()
msg_Err( getIntf(), "unknown bitmap id: %s", id.c_str() ); \
return; \
} \
} \
else if( abort )\
{ \
msg_Err( getIntf(), "bitmap required for id: %s", rData.m_id.c_str() ); \
return; \
}
// macro to check bitmap size consistency for button and checkbox
...
...
@@ -244,7 +249,7 @@ void Builder::addSubBitmap( const BuilderData::SubBitmap &rData )
// Get the parent bitmap
GenericBitmap
*
pParentBmp
=
NULL
;
GET_BMP
(
pParentBmp
,
rData
.
m_parent
);
GET_BMP
(
pParentBmp
,
rData
.
m_parent
,
true
);
// Copy a region of the parent bitmap to the new one
BitmapImpl
*
pBmp
=
...
...
@@ -457,13 +462,13 @@ void Builder::addButton( const BuilderData::Button &rData )
{
// Get the bitmaps of the button
GenericBitmap
*
pBmpUp
=
NULL
;
GET_BMP
(
pBmpUp
,
rData
.
m_upId
);
GET_BMP
(
pBmpUp
,
rData
.
m_upId
,
true
);
GenericBitmap
*
pBmpDown
=
pBmpUp
;
GET_BMP
(
pBmpDown
,
rData
.
m_downId
);
GET_BMP
(
pBmpDown
,
rData
.
m_downId
,
false
);
GenericBitmap
*
pBmpOver
=
pBmpUp
;
GET_BMP
(
pBmpOver
,
rData
.
m_overId
);
GET_BMP
(
pBmpOver
,
rData
.
m_overId
,
false
);
GenericLayout
*
pLayout
=
m_pTheme
->
getLayoutById
(
rData
.
m_layoutId
);
if
(
pLayout
==
NULL
)
...
...
@@ -519,22 +524,22 @@ void Builder::addCheckbox( const BuilderData::Checkbox &rData )
{
// Get the bitmaps of the checkbox
GenericBitmap
*
pBmpUp1
=
NULL
;
GET_BMP
(
pBmpUp1
,
rData
.
m_up1Id
);
GET_BMP
(
pBmpUp1
,
rData
.
m_up1Id
,
true
);
GenericBitmap
*
pBmpDown1
=
pBmpUp1
;
GET_BMP
(
pBmpDown1
,
rData
.
m_down1Id
);
GET_BMP
(
pBmpDown1
,
rData
.
m_down1Id
,
false
);
GenericBitmap
*
pBmpOver1
=
pBmpUp1
;
GET_BMP
(
pBmpOver1
,
rData
.
m_over1Id
);
GET_BMP
(
pBmpOver1
,
rData
.
m_over1Id
,
false
);
GenericBitmap
*
pBmpUp2
=
NULL
;
GET_BMP
(
pBmpUp2
,
rData
.
m_up2Id
);
GET_BMP
(
pBmpUp2
,
rData
.
m_up2Id
,
true
);
GenericBitmap
*
pBmpDown2
=
pBmpUp2
;
GET_BMP
(
pBmpDown2
,
rData
.
m_down2Id
);
GET_BMP
(
pBmpDown2
,
rData
.
m_down2Id
,
false
);
GenericBitmap
*
pBmpOver2
=
pBmpUp2
;
GET_BMP
(
pBmpOver2
,
rData
.
m_over2Id
);
GET_BMP
(
pBmpOver2
,
rData
.
m_over2Id
,
false
);
GenericLayout
*
pLayout
=
m_pTheme
->
getLayoutById
(
rData
.
m_layoutId
);
if
(
pLayout
==
NULL
)
...
...
@@ -611,7 +616,7 @@ void Builder::addCheckbox( const BuilderData::Checkbox &rData )
void
Builder
::
addImage
(
const
BuilderData
::
Image
&
rData
)
{
GenericBitmap
*
pBmp
=
NULL
;
GET_BMP
(
pBmp
,
rData
.
m_bmpId
);
GET_BMP
(
pBmp
,
rData
.
m_bmpId
,
true
);
GenericLayout
*
pLayout
=
m_pTheme
->
getLayoutById
(
rData
.
m_layoutId
);
if
(
pLayout
==
NULL
)
...
...
@@ -810,7 +815,7 @@ void Builder::addRadialSlider( const BuilderData::RadialSlider &rData )
{
// Get the bitmaps of the slider
GenericBitmap
*
pSeq
=
NULL
;
GET_BMP
(
pSeq
,
rData
.
m_sequence
);
GET_BMP
(
pSeq
,
rData
.
m_sequence
,
true
);
GenericLayout
*
pLayout
=
m_pTheme
->
getLayoutById
(
rData
.
m_layoutId
);
if
(
pLayout
==
NULL
)
...
...
@@ -864,7 +869,7 @@ void Builder::addSlider( const BuilderData::Slider &rData )
// Get the bitmaps of the background
GenericBitmap
*
pBgImage
=
NULL
;
GET_BMP
(
pBgImage
,
rData
.
m_imageId
);
GET_BMP
(
pBgImage
,
rData
.
m_imageId
,
false
);
GenericLayout
*
pLayout
=
m_pTheme
->
getLayoutById
(
rData
.
m_layoutId
);
if
(
pLayout
==
NULL
)
...
...
@@ -916,13 +921,13 @@ void Builder::addSlider( const BuilderData::Slider &rData )
// Get the bitmaps of the cursor
GenericBitmap
*
pBmpUp
=
NULL
;
GET_BMP
(
pBmpUp
,
rData
.
m_upId
);
GET_BMP
(
pBmpUp
,
rData
.
m_upId
,
true
);
GenericBitmap
*
pBmpDown
=
pBmpUp
;
GET_BMP
(
pBmpDown
,
rData
.
m_downId
);
GET_BMP
(
pBmpDown
,
rData
.
m_downId
,
false
);
GenericBitmap
*
pBmpOver
=
pBmpUp
;
GET_BMP
(
pBmpOver
,
rData
.
m_overId
);
GET_BMP
(
pBmpOver
,
rData
.
m_overId
,
false
);
// Create the cursor control
CtrlSliderCursor
*
pCursor
=
new
CtrlSliderCursor
(
getIntf
(),
*
pBmpUp
,
...
...
@@ -942,7 +947,7 @@ void Builder::addList( const BuilderData::List &rData )
{
// Get the background bitmap, if any
GenericBitmap
*
pBgBmp
=
NULL
;
GET_BMP
(
pBgBmp
,
rData
.
m_bgImageId
);
GET_BMP
(
pBgBmp
,
rData
.
m_bgImageId
,
false
);
GenericLayout
*
pLayout
=
m_pTheme
->
getLayoutById
(
rData
.
m_layoutId
);
if
(
pLayout
==
NULL
)
...
...
@@ -1003,10 +1008,10 @@ void Builder::addTree( const BuilderData::Tree &rData )
GenericBitmap
*
pItemBmp
=
NULL
;
GenericBitmap
*
pOpenBmp
=
NULL
;
GenericBitmap
*
pClosedBmp
=
NULL
;
GET_BMP
(
pBgBmp
,
rData
.
m_bgImageId
);
GET_BMP
(
pItemBmp
,
rData
.
m_itemImageId
);
GET_BMP
(
pOpenBmp
,
rData
.
m_openImageId
);
GET_BMP
(
pClosedBmp
,
rData
.
m_closedImageId
);
GET_BMP
(
pBgBmp
,
rData
.
m_bgImageId
,
false
);
GET_BMP
(
pItemBmp
,
rData
.
m_itemImageId
,
false
);
GET_BMP
(
pOpenBmp
,
rData
.
m_openImageId
,
false
);
GET_BMP
(
pClosedBmp
,
rData
.
m_closedImageId
,
false
);
GenericLayout
*
pLayout
=
m_pTheme
->
getLayoutById
(
rData
.
m_layoutId
);
if
(
pLayout
==
NULL
)
...
...
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