[vlc-commits] [Git][videolan/vlc][3.0.x] skins2: parser: check parent list before access

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Aug 28 10:36:47 UTC 2026



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
17bf13a6 by François Cartegnie at 2026-08-28T10:23:35+00:00
skins2: parser: check parent list before access

refs #29930

(cherry picked from commit fbe4f7f2870846e246e58ac4532340ff6129c268)

- - - - -


1 changed file:

- modules/gui/skins2/parser/skin_parser.cpp


Changes:

=====================================
modules/gui/skins2/parser/skin_parser.cpp
=====================================
@@ -203,7 +203,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
         m_pData->m_listPopupMenu.push_back( popup );
     }
 
-    else if( rName == "MenuItem" )
+    else if( rName == "MenuItem" && !m_popupPosList.empty() )
     {
         RequireAttr( attr, rName, "label" );
         DefaultAttr( attr, "action", "none" );
@@ -215,7 +215,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
         m_popupPosList.back()++;
     }
 
-    else if( rName == "MenuSeparator" )
+    else if( rName == "MenuSeparator" && !m_popupPosList.empty() )
     {
         const BuilderData::MenuSeparator sep( m_popupPosList.back(),
                                               m_curPopupId );
@@ -223,7 +223,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
         m_popupPosList.back()++;
     }
 
-    else if( rName == "Button" )
+    else if( rName == "Button" && !m_panelStack.empty() )
     {
         RequireAttr( attr, rName, "up" );
         DefaultAttr( attr, "id", "none" );
@@ -256,7 +256,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
         m_pData->m_listButton.push_back( button );
     }
 
-    else if( rName == "Checkbox" )
+    else if( rName == "Checkbox" && !m_panelStack.empty() )
     {
         RequireAttr( attr, rName, "up1" );
         RequireAttr( attr, rName, "up2" );
@@ -319,7 +319,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
         m_yOffsetList.push_back( atoi( attr["y"] ) );
     }
 
-    else if( rName == "Image" )
+    else if( rName == "Image" && !m_panelStack.empty() )
     {
         RequireAttr( attr, rName, "image" );
         DefaultAttr( attr, "id", "none" );
@@ -386,7 +386,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
         m_curLayer = 0;
     }
 
-    else if( rName == "Panel" )
+    else if( rName == "Panel" && !m_panelStack.empty() )
     {
         DefaultAttr( attr, "x", "0" );
         DefaultAttr( attr, "y", "0" );
@@ -427,7 +427,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
         m_panelStack.push_back( panelId );
     }
 
-    else if( rName == "Playlist" )
+    else if( rName == "Playlist" && !m_panelStack.empty() )
     {
         RequireAttr( attr, rName, "id" );
         RequireAttr( attr, rName, "font" );
@@ -488,7 +488,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
         m_curLayer++;
         m_pData->m_listTree.push_back( treeData );
     }
-    else if( rName == "Playtree" )
+    else if( rName == "Playtree" && !m_panelStack.empty() )
     {
         RequireAttr( attr, rName, "id" );
         RequireAttr( attr, rName, "font" );
@@ -548,7 +548,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
         m_pData->m_listTree.push_back( treeData );
     }
 
-    else if( rName == "RadialSlider" )
+    else if( rName == "RadialSlider" && !m_panelStack.empty() )
     {
         RequireAttr( attr, rName, "sequence" );
         RequireAttr( attr, rName, "nbimages" );
@@ -584,7 +584,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
         m_pData->m_listRadialSlider.push_back( radial );
     }
 
-    else if( rName == "Slider" )
+    else if( rName == "Slider" && !m_panelStack.empty() )
     {
         RequireAttr( attr, rName, "up" );
         RequireAttr( attr, rName, "points" );
@@ -631,7 +631,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
         m_pData->m_listSlider.push_back( slider );
     }
 
-    else if( rName == "SliderBackground" )
+    else if( rName == "SliderBackground" && !m_pData->m_listSlider.empty() )
     {
         RequireAttr( attr, rName, "image" );
         DefaultAttr( attr, "nbhoriz", "1" );
@@ -649,7 +649,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
         slider.m_padVert = atoi( attr["padvert"] );
     }
 
-    else if( rName == "Text" )
+    else if( rName == "Text" && !m_panelStack.empty() )
     {
         RequireAttr( attr, rName, "font" );
         DefaultAttr( attr, "id", "none" );
@@ -724,7 +724,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
                   attr["author"] );
     }
 
-    else if( rName == "Video" )
+    else if( rName == "Video" && !m_panelStack.empty() )
     {
         DefaultAttr( attr, "id", "none" );
         DefaultAttr( attr, "visible", "true" );
@@ -803,7 +803,7 @@ void SkinParser::handleBeginElement( const std::string &rName, AttrList_t &attr
 
 void SkinParser::handleEndElement( const std::string &rName )
 {
-    if( rName == "Group" )
+    if( rName == "Group" && !m_xOffsetList.empty() && !m_yOffsetList.empty() )
     {
         m_xOffset -= m_xOffsetList.back();
         m_yOffset -= m_yOffsetList.back();
@@ -814,12 +814,12 @@ void SkinParser::handleEndElement( const std::string &rName )
     {
         m_curTreeId = "";
     }
-    else if( rName == "Popup" )
+    else if( rName == "Popup" && !m_popupPosList.empty() )
     {
         m_curPopupId = "";
         m_popupPosList.pop_back();
     }
-    else if( rName == "Panel" )
+    else if( rName == "Panel" && !m_panelStack.empty() )
     {
         m_panelStack.pop_back();
     }
@@ -916,7 +916,7 @@ void SkinParser::getRefDimensions( int &rWidth, int &rHeight, bool toScreen )
         return;
     }
 
-    std::string panelId = m_panelStack.back();
+    std::string panelId = m_panelStack.empty() ? "none" : m_panelStack.back();
     if( panelId != "none" )
     {
         std::list<BuilderData::Panel>::const_iterator it;
@@ -931,7 +931,7 @@ void SkinParser::getRefDimensions( int &rWidth, int &rHeight, bool toScreen )
             }
         }
     }
-    else
+    else if( !m_pData->m_listLayout.empty() )
     {
         const BuilderData::Layout layout = m_pData->m_listLayout.back();
         rWidth = layout.m_width;
@@ -1043,6 +1043,9 @@ void SkinParser::convertPosition( std::string position, std::string xOffset,
 
 void SkinParser::updateWindowPos( int width, int height )
 {
+    if( m_pData->m_listWindow.empty() )
+        return;
+
     BuilderData::Window win = m_pData->m_listWindow.back();
     m_pData->m_listWindow.pop_back();
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/17bf13a6e08690b6104a28a7057d4812588e20a7

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/17bf13a6e08690b6104a28a7057d4812588e20a7
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list